From e61c09fe7426adfd85417703ef05c0912981006f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Apr 2016 20:02:59 +0300 Subject: servergreps: add some more packet version logs. --- servergreps/hercules/00000000/clientpackets.txt | 21 + servergreps/hercules/00000000/serverpackets.txt | 404 + servergreps/hercules/00000000/src/char.c | 16246 +++++++ servergreps/hercules/00000000/src/clif.c | 43876 +++++++++++++++++++ servergreps/hercules/00000000/src/login.c | 9126 ++++ servergreps/hercules/00000000/uselesspackets.txt | 113 + servergreps/hercules/00000007/serverpackets.txt | 210 - servergreps/hercules/00000007/src/char.c | 16246 +++++++ servergreps/hercules/00000007/src/clif.c | 43984 +++++++++++++++++++ servergreps/hercules/00000007/src/login.c | 9126 ++++ servergreps/hercules/20120700/clientpackets.txt | 32 + servergreps/hercules/20120700/serverpackets.txt | 419 + servergreps/hercules/20120700/src/char.c | 16369 +++++++ servergreps/hercules/20120700/src/clif.c | 45847 ++++++++++++++++++++ servergreps/hercules/20120700/src/login.c | 9118 ++++ servergreps/hercules/20120700/uselesspackets.txt | 42 + servergreps/hercules/20130000/serverpackets.txt | 199 - servergreps/hercules/20130000/src/char.c | 16373 +++++++ servergreps/hercules/20130000/src/clif.c | 45948 ++++++++++++++++++++ servergreps/hercules/20130000/src/login.c | 9118 ++++ servergreps/hercules/20130221/clientpackets.txt | 31 + servergreps/hercules/20130221/serverpackets.txt | 420 + servergreps/hercules/20130221/src/char.c | 16373 +++++++ servergreps/hercules/20130221/src/clif.c | 45948 ++++++++++++++++++++ servergreps/hercules/20130221/src/login.c | 9118 ++++ servergreps/hercules/20130221/uselesspackets.txt | 41 + servergreps/hercules/20140000/serverpackets.txt | 196 - servergreps/hercules/20140000/src/char.c | 16373 +++++++ servergreps/hercules/20140000/src/clif.c | 46647 ++++++++++++++++++++ servergreps/hercules/20140000/src/login.c | 9118 ++++ servergreps/hercules/20140403/clientpackets.txt | 30 + servergreps/hercules/20140403/serverpackets.txt | 423 + servergreps/hercules/20140403/src/char.c | 16373 +++++++ servergreps/hercules/20140403/src/clif.c | 46818 ++++++++++++++++++++ servergreps/hercules/20140403/src/login.c | 9118 ++++ servergreps/hercules/20140403/uselesspackets.txt | 29 + servergreps/hercules/20141016/serverpackets.txt | 196 - servergreps/hercules/20141016/src/char.c | 16364 +++++++ servergreps/hercules/20141016/src/clif.c | 46909 ++++++++++++++++++++ servergreps/hercules/20141016/src/login.c | 9118 ++++ servergreps/hercules/20141022/serverpackets.txt | 195 - servergreps/hercules/20141022/src/char.c | 16371 +++++++ servergreps/hercules/20141022/src/clif.c | 46955 ++++++++++++++++++++ servergreps/hercules/20141022/src/login.c | 9118 ++++ servergreps/hercules/20150226/serverpackets.txt | 195 - servergreps/hercules/20150226/src/char.c | 16371 +++++++ servergreps/hercules/20150226/src/clif.c | 46996 ++++++++++++++++++++ servergreps/hercules/20150226/src/login.c | 9118 ++++ servergreps/hercules/20150513/serverpackets.txt | 195 - servergreps/hercules/20150513/src/char.c | 16371 +++++++ servergreps/hercules/20150513/src/clif.c | 47040 ++++++++++++++++++++ servergreps/hercules/20150513/src/login.c | 9118 ++++ servergreps/hercules/20150805/serverpackets.txt | 194 - servergreps/hercules/20150805/src/char.c | 16371 +++++++ servergreps/hercules/20150805/src/clif.c | 47075 +++++++++++++++++++++ servergreps/hercules/20150805/src/login.c | 9118 ++++ 56 files changed, 861681 insertions(+), 1580 deletions(-) create mode 100644 servergreps/hercules/00000000/clientpackets.txt create mode 100644 servergreps/hercules/00000000/serverpackets.txt create mode 100644 servergreps/hercules/00000000/src/char.c create mode 100644 servergreps/hercules/00000000/src/clif.c create mode 100644 servergreps/hercules/00000000/src/login.c create mode 100644 servergreps/hercules/00000000/uselesspackets.txt create mode 100644 servergreps/hercules/00000007/src/char.c create mode 100644 servergreps/hercules/00000007/src/clif.c create mode 100644 servergreps/hercules/00000007/src/login.c create mode 100644 servergreps/hercules/20120700/clientpackets.txt create mode 100644 servergreps/hercules/20120700/serverpackets.txt create mode 100644 servergreps/hercules/20120700/src/char.c create mode 100644 servergreps/hercules/20120700/src/clif.c create mode 100644 servergreps/hercules/20120700/src/login.c create mode 100644 servergreps/hercules/20120700/uselesspackets.txt create mode 100644 servergreps/hercules/20130000/src/char.c create mode 100644 servergreps/hercules/20130000/src/clif.c create mode 100644 servergreps/hercules/20130000/src/login.c create mode 100644 servergreps/hercules/20130221/clientpackets.txt create mode 100644 servergreps/hercules/20130221/serverpackets.txt create mode 100644 servergreps/hercules/20130221/src/char.c create mode 100644 servergreps/hercules/20130221/src/clif.c create mode 100644 servergreps/hercules/20130221/src/login.c create mode 100644 servergreps/hercules/20130221/uselesspackets.txt create mode 100644 servergreps/hercules/20140000/src/char.c create mode 100644 servergreps/hercules/20140000/src/clif.c create mode 100644 servergreps/hercules/20140000/src/login.c create mode 100644 servergreps/hercules/20140403/clientpackets.txt create mode 100644 servergreps/hercules/20140403/serverpackets.txt create mode 100644 servergreps/hercules/20140403/src/char.c create mode 100644 servergreps/hercules/20140403/src/clif.c create mode 100644 servergreps/hercules/20140403/src/login.c create mode 100644 servergreps/hercules/20140403/uselesspackets.txt create mode 100644 servergreps/hercules/20141016/src/char.c create mode 100644 servergreps/hercules/20141016/src/clif.c create mode 100644 servergreps/hercules/20141016/src/login.c create mode 100644 servergreps/hercules/20141022/src/char.c create mode 100644 servergreps/hercules/20141022/src/clif.c create mode 100644 servergreps/hercules/20141022/src/login.c create mode 100644 servergreps/hercules/20150226/src/char.c create mode 100644 servergreps/hercules/20150226/src/clif.c create mode 100644 servergreps/hercules/20150226/src/login.c create mode 100644 servergreps/hercules/20150513/src/char.c create mode 100644 servergreps/hercules/20150513/src/clif.c create mode 100644 servergreps/hercules/20150513/src/login.c create mode 100644 servergreps/hercules/20150805/src/char.c create mode 100644 servergreps/hercules/20150805/src/clif.c create mode 100644 servergreps/hercules/20150805/src/login.c (limited to 'servergreps/hercules') diff --git a/servergreps/hercules/00000000/clientpackets.txt b/servergreps/hercules/00000000/clientpackets.txt new file mode 100644 index 0000000..8418cf2 --- /dev/null +++ b/servergreps/hercules/00000000/clientpackets.txt @@ -0,0 +1,21 @@ +UNIMPLIMENTED CMSG_PARTY_CREATE2 +UNIMPLIMENTED CMSG_PARTY_INVITED +0072 19 clif->pWantToConnection +007e 6 clif->pTickSend +0085 5 clif->pWalkToXY +0089 7 clif->pActionRequest +008c -1 clif->pGlobalMessage +0094 6 clif->pGetCharNameRequest +009b 5 clif->pChangeDir +009f 6 clif->pTakeItem +00a2 6 clif->pDropItem +00a7 8 clif->pUseItem +00a9 6 clif->pEquipItem +00f5 8 clif->pMoveFromKafra +00f7 2 clif->pCloseKafra +0113 10 clif->pUseSkillToId +0116 10 clif->pUseSkillToPos +013f 26 clif->pGM_Monster_Item +0190 90 clif->pUseSkillToPosMoreInfo +096e -1 clif->ackmergeitems +0974 2 clif->cancelmergeitem diff --git a/servergreps/hercules/00000000/serverpackets.txt b/servergreps/hercules/00000000/serverpackets.txt new file mode 100644 index 0000000..b80d96b --- /dev/null +++ b/servergreps/hercules/00000000/serverpackets.txt @@ -0,0 +1,404 @@ +j +69 client name: SMSG_LOGIN_DATA +6a client name: SMSG_LOGIN_ERROR +6b client name: SMSG_CHAR_LOGIN +6c client name: SMSG_CHAR_LOGIN_ERROR +6d client name: SMSG_CHAR_CREATE_SUCCEEDED +6e client name: SMSG_CHAR_CREATE_FAILED +6f client name: SMSG_CHAR_DELETE_SUCCEEDED +70 client name: SMSG_CHAR_DELETE_FAILED +71 client name: SMSG_CHAR_MAP_INFO +73 client name: SMSG_MAP_LOGIN_SUCCESS +74 client name: SMSG_MAP_AUTH_REFUSE +78 client name: SMSG_BEING_FAKE_NAME +79 client name: SMSG_BEING_SPAWN +7b client name: SMSG_BEING_MOVE +7c client name: SMSG_BEING_SPAWN_OUTDATED +7f client name: SMSG_SERVER_PING +80 client name: SMSG_BEING_REMOVE +81 client name: SMSG_CONNECTION_PROBLEM +86 client name: SMSG_BEING_MOVE2 +87 client name: SMSG_WALK_RESPONSE +88 client name: SMSG_PLAYER_STOP +8a client name: SMSG_BEING_ACTION +8d client name: SMSG_BEING_CHAT +8e client name: SMSG_PLAYER_CHAT +91 client name: SMSG_PLAYER_WARP +92 client name: SMSG_CHANGE_MAP_SERVER +95 client name: SMSG_BEING_NAME_RESPONSE +97 client name: SMSG_WHISPER +98 client name: SMSG_WHISPER_RESPONSE +9a client name: SMSG_GM_CHAT +9c client name: SMSG_BEING_CHANGE_DIRECTION +9d client name: SMSG_ITEM_VISIBLE +9e client name: SMSG_ITEM_DROPPED +a0 client name: SMSG_PLAYER_INVENTORY_ADD +a1 client name: SMSG_ITEM_REMOVE +a3 client name: SMSG_PLAYER_INVENTORY +a4 client name: SMSG_PLAYER_EQUIPMENT +a5 client name: SMSG_PLAYER_STORAGE_ITEMS +a6 client name: SMSG_PLAYER_STORAGE_EQUIP +a8 client name: SMSG_ITEM_USE_RESPONSE +aa client name: SMSG_PLAYER_EQUIP +ac client name: SMSG_PLAYER_UNEQUIP +af client name: SMSG_PLAYER_INVENTORY_REMOVE +b0 client name: SMSG_PLAYER_STAT_UPDATE_1 +b1 client name: SMSG_PLAYER_STAT_UPDATE_2 +b3 client name: SMSG_CHAR_SWITCH_RESPONSE +b4 client name: SMSG_NPC_MESSAGE +b5 client name: SMSG_NPC_NEXT +b6 client name: SMSG_NPC_CLOSE +b7 client name: SMSG_NPC_CHOICE +bc client name: SMSG_PLAYER_STAT_UPDATE_4 +bd client name: SMSG_PLAYER_STAT_UPDATE_5 +be client name: SMSG_PLAYER_STAT_UPDATE_6 +c0 client name: SMSG_BEING_EMOTION +c2 client name: SMSG_WHO_ANSWER +c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED +c4 client name: SMSG_NPC_BUY_SELL_CHOICE +c6 client name: SMSG_NPC_BUY +c7 client name: SMSG_NPC_SELL +ca client name: SMSG_NPC_BUY_RESPONSE +cb client name: SMSG_NPC_SELL_RESPONSE +cd client name: SMSG_ADMIN_KICK_ACK +d1 client name: SMSG_IGNORE_NICK_ACK +d2 client name: SMSG_IGNORE_ALL_RESPONSE +d4 client name: SMSG_CHAT_IGNORE_LIST +d6 client name: SMSG_CHAT_ROOM_CREATE_ACK +d7 client name: SMSG_CHAT_DISPLAY +d8 client name: SMSG_CHAT_ROOM_DESTROY +da client name: SMSG_CHAT_ROOM_JOIN_FAILED +db client name: SMSG_CHAT_ROOM_JOIN_ACK +dc client name: SMSG_CHAT_ROOM_ADD_MEMBER +dd client name: SMSG_CHAT_ROOM_LEAVE +df client name: SMSG_CHAT_ROOM_SETTINGS +e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE +e5 client name: SMSG_TRADE_REQUEST +e7 client name: SMSG_TRADE_RESPONSE_OUTDATED +e9 client name: SMSG_TRADE_ITEM_ADD +ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE +ec client name: SMSG_TRADE_OK +ee client name: SMSG_TRADE_CANCEL +f0 client name: SMSG_TRADE_COMPLETE +f1 client name: SMSG_TRADE_UNDO +f2 client name: SMSG_PLAYER_STORAGE_STATUS +f4 client name: SMSG_PLAYER_STORAGE_ADD +f6 client name: SMSG_PLAYER_STORAGE_REMOVE +f8 client name: SMSG_PLAYER_STORAGE_CLOSE +fa client name: SMSG_PARTY_CREATE +fb client name: SMSG_PARTY_INFO +fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED +fe client name: SMSG_PARTY_INVITED +101 client name: SMSG_PARTY_SETTINGS +105 client name: SMSG_PARTY_LEAVE +106 client name: SMSG_PLAYER_HP +107 client name: SMSG_PARTY_UPDATE_COORDS +109 client name: SMSG_PARTY_MESSAGE +10a client name: SMSG_MVP_ITEM +10b client name: SMSG_MVP_EXP +10c client name: SMSG_MVP_EFFECT +10d client name: SMSG_MVP_NO_ITEM +10e client name: SMSG_PLAYER_SKILL_UP +10f client name: SMSG_PLAYER_SKILLS +110 client name: SMSG_SKILL_FAILED +111 client name: SMSG_PLAYER_ADD_SKILL +114 client name: SMSG_SKILL_DAMAGE +117 client name: SMSG_SKILL_GROUND_NO_DAMAGE +119 client name: SMSG_PLAYER_STATUS_CHANGE +11a client name: SMSG_SKILL_NO_DAMAGE +11c client name: SMSG_SKILL_WARP_POINT +11e client name: SMSG_SKILL_MEMO_MESSAGE +11f client name: SMSG_SKILL_ENTRY +120 client name: SMSG_BEING_REMOVE_SKILL +121 client name: SMSG_CART_INFO +122 client name: SMSG_PLAYER_CART_EQUIP +123 client name: SMSG_PLAYER_CART_ITEMS +124 client name: SMSG_PLAYER_CART_ADD +125 client name: SMSG_PLAYER_CART_REMOVE +12b client name: SMSG_CART_REMOVE +12c client name: SMSG_PLAYER_CART_ADD_ERROR +12d client name: SMSG_VENDING_OPEN_REQ +131 client name: SMSG_VENDING_SHOW_BOARD +132 client name: SMSG_VENDING_HIDE_BOARD +133 client name: SMSG_VENDING_ITEMS_LIST +135 client name: SMSG_VENDING_BUY_ACK +136 client name: SMSG_VENDING_OPEN +137 client name: SMSG_VENDING_REPORT +139 client name: SMSG_PLAYER_MOVE_TO_ATTACK +13a client name: SMSG_PLAYER_ATTACK_RANGE +13b client name: SMSG_PLAYER_ARROW_MESSAGE +13c client name: SMSG_PLAYER_ARROW_EQUIP +13d client name: SMSG_PLAYER_HEAL +13e client name: SMSG_SKILL_CASTING +141 client name: SMSG_PLAYER_STAT_UPDATE_3 +142 client name: SMSG_NPC_INT_INPUT +144 client name: SMSG_NPC_VIEWPOINT +147 client name: SMSG_SKILL_AUTO_CAST +148 client name: SMSG_BEING_RESURRECT +14a client name: SMSG_MANNER_MESSAGE +14b client name: SMSG_CHAT_SILENCE +14c client name: SMSG_GUILD_ALIANCE_INFO +14e client name: SMSG_GUILD_MASTER_OR_MEMBER +152 client name: SMSG_GUILD_EMBLEM_DATA +154 client name: SMSG_GUILD_MEMBER_LIST +156 client name: SMSG_GUILD_MEMBER_POS_CHANGE +15a client name: SMSG_GUILD_LEAVE +15e client name: SMSG_GUILD_BROKEN +160 client name: SMSG_GUILD_POS_INFO_LIST +162 client name: SMSG_GUILD_SKILL_INFO +163 client name: SMSG_GUILD_EXPULSION_LIST +166 client name: SMSG_GUILD_POS_NAME_LIST +167 client name: SMSG_GUILD_CREATE_RESPONSE +169 client name: SMSG_GUILD_INVITE_ACK +16a client name: SMSG_GUILD_INVITE +16c client name: SMSG_GUILD_POSITION_INFO +16f client name: SMSG_GUILD_NOTICE +171 client name: SMSG_GUILD_REQ_ALLIANCE +173 client name: SMSG_GUILD_REQ_ALLIANCE_ACK +174 client name: SMSG_GUILD_POSITION_CHANGED +177 client name: SMSG_PLAYER_IDENTIFY_LIST +179 client name: SMSG_PLAYER_IDENTIFIED +17b client name: SMSG_PLAYER_USE_CARD +17d client name: SMSG_PLAYER_INSERT_CARD +17f client name: SMSG_GUILD_MESSAGE +181 client name: SMSG_GUILD_OPPOSITION_ACK +184 client name: SMSG_GUILD_DEL_ALLIANCE +188 client name: SMSG_PLAYER_REFINE +189 client name: SMSG_PLAYER_NOTIFY_MAPINFO +18b client name: SMSG_MAP_QUIT_RESPONSE +18c client name: SMSG_MONSTER_INFO +18d client name: SMSG_PLAYER_SKILL_PRODUCE_MIX_LIST +18f client name: SMSG_PLAYER_SKILL_PRODUCE_EFFECT +191 client name: SMSG_CHAT_TALKIE_BOX +192 client name: SMSG_ADMIN_SET_TILE_TYPE +194 client name: SMSG_SOLVE_CHAR_NAME +196 client name: SMSG_BEING_STATUS_CHANGE +199 client name: SMSG_PVP_MAP_MODE +19a client name: SMSG_PVP_SET +19b client name: SMSG_BEING_SELFEFFECT +19e client name: SMSG_PET_CATCH_PROCESS +1a0 client name: SMSG_PET_ROULETTE +1a2 client name: SMSG_PET_STATUS +1a3 client name: SMSG_PET_FOOD +1a4 client name: SMSG_PET_DATA +1a6 client name: SMSG_PET_EGGS_LIST +1aa client name: SMSG_PET_MESSAGE +1ab client name: SMSG_BEING_STAT_UPDATE_1 +1ac client name: SMSG_SKILL_UNIT_UPDATE +1ad client name: SMSG_SKILL_ARROW_CREATE_LIST +1b0 client name: SMSG_CLASS_CHANGE +1b1 client name: SMSG_NPC_SHOW_DIGIT +1b3 client name: SMSG_NPC_CUTIN +1b4 client name: SMSG_GUILD_EMBLEM +1b6 client name: SMSG_GUILD_BASIC_INFO +1b9 client name: SMSG_SKILL_CAST_CANCEL +1c3 client name: SMSG_GM_CHAT2 +1c9 client name: SMSG_GRAFFITI_VISIBLE +1cd client name: SMSG_PLAYER_SKILL_AUTO_SPELLS +1cf client name: SMSG_SKILL_DEVOTION_EFFECT +1d0 client name: SMSG_SPIRIT_BALLS +1d1 client name: SMSG_BLADE_STOP +1d2 client name: SMSG_COMBO_DELAY +1d3 client name: SMSG_BEING_SOUND_EFFECT +1d4 client name: SMSG_NPC_STR_INPUT +1d6 client name: SMSG_MAP_TYPE +1dc client name: SMSG_LOGIN_CODING_KEY +1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK +1e1 client name: SMSG_SPIRIT_BALL_SINGLE +1e6 client name: SMSG_FAMILY_CALL_PARTNER +1e9 client name: SMSG_PARTY_MEMBER_INFO +1ea client name: SMSG_WEDDING_EFFECT +1eb client name: SMSG_GUILD_UPDATE_COORDS +1f2 client name: SMSG_GUILD_MEMBER_LOGIN +1f3 client name: SMSG_BEING_SPECIAL_EFFECT +1f6 client name: SMSG_FAMILY_ASK_FOR_CHILD +1fc client name: SMSG_PLAYER_REPAIR_LIST +1fe client name: SMSG_PLAYER_REPAIR_EFFECT +1ff client name: SMSG_BEING_SLIDE +201 client name: SMSG_FRIENDS_LIST +205 client name: SMSG_FAMILY_DIVORCED +206 client name: SMSG_FRIENDS_PLAYER_ONLINE +207 client name: SMSG_FRIENDS_REQUEST +209 client name: SMSG_FRIENDS_REQUEST_ACK +20a client name: SMSG_FRIENDS_DELETE_PLAYER +20d client name: SMSG_CHAR_BAN_CHAR_LIST +20e +210 +214 +215 +216 +219 +21a +21b +21c +221 +223 +224 +226 +22e +22f +230 +235 +238 +239 +23a +23c +240 +242 +245 +249 +24a +250 +252 +253 +255 +256 +257 +25a +25d client name: CMSG_AUCTION_CLOSE +25f +260 +274 +284 +287 +289 +28a +28e client name: SMSG_CHAR_CHECK_RENAME +290 client name: SMSG_CHAR_RENAME +291 +293 +294 +298 +299 +29b +29d +2a2 +2b1 client name: SMSG_QUEST_LIST +2b2 +2b3 +2b4 +2b5 +2b7 +2bb +2c1 +2c9 +2cb +2cc +2cd +2ce +2d3 client name: SMSG_BIND_ITEM +2d7 client name: SMSG_BEING_VIEW_EQUIPMENT +2d9 +2da +2dc +2dd +2de +2df +2e0 +2f0 +2f2 +43e +43f +442 +7e1 +7e6 +7e9 +7f6 +7fc client name: SMSG_PARTY_LEADER +7fd client name: SMSG_ITEM_MVP_DROPPED +7fe +803 +805 +807 +809 +80a +80b +810 +812 +813 +814 +816 +818 +81a +81b +81c +81d +81e +824 +828 client name: SMSG_CHAR_DELETE2_ACK +82a client name: SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK +82c client name: SMSG_CHAR_DELETE2_CANCEL_ACK +82d client name: SMSG_CHAR_LOGIN2 +836 +837 +83a +83d +840 client name: SMSG_MAP_NOT_FOUND +845 client name: SMSG_NPC_CASH_POINTS +849 client name: SMSG_NPC_CASH_BUY +8b3 client name: SMSG_SCRIPT_MESSAGE +8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST +8ca client name: SMSG_NPC_CASH_SCHEDULE +8cf +8d2 +8d5 client name: SMSG_CHAR_CHANGE_SLOT +8d6 client name: SMSG_NPC_CLOSE_TIMEOUT +8d8 client name: SMSG_BATTLE_QUEUE_ACK +8d9 client name: SMSG_BATTLE_JOINED +8db client name: SMSG_BATTLE_NOTICE_DELETE +8df client name: SMSG_BATTLE_BEGINS +908 +96d client name: SMSG_MERGE_ITEM +96f client name: SMSG_ACK_MERGE_ITEMS +977 +97d client name: SMSG_RANKS_LIST +99d client name: SMSG_CHAR_CHARACTERS +9a6 +9a8 +9aa +a02 +a1a +a1c +a20 +a22 +2711 +2713 +2716 +2717 +2718 +2719 +2722 +2723 +2728 +272b +272c +272d +272e +2731 +2734 +2735 +2736 +2737 +2740 +2af9 +2afb +2afd +2b00 +2b03 +2b04 +2b06 +2b09 +2b0d +2b0f +2b12 +2b14 +2b1b +2b1d +2b1e +2b20 +2b21 +2b22 +2b24 +2b25 +2b27 +status_changetype diff --git a/servergreps/hercules/00000000/src/char.c b/servergreps/hercules/00000000/src/char.c new file mode 100644 index 0000000..486575e --- /dev/null +++ b/servergreps/hercules/00000000/src/char.c @@ -0,0 +1,16246 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, + + + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + + + + + int8 HERC__unavailable_struct; + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } +# 684 "../../../server-code/src/char/char.c" + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + + + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); +# 1310 "../../../server-code/src/char/char.c" + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + + + if((slot < 0 || slot >= sd->char_slots) + || (str + agi + vit + int_ + dex + luk != 6*5 ) + || (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) + || (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) + + + + + return -2; + + + + if( sd->found_char[slot] != -1 ) + return -2; +# 1583 "../../../server-code/src/char/char.c" + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1588, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1588, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1590)); + return -2; + } + + + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); +# 1767 "../../../server-code/src/char/char.c" + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + + + + + + WBUFW(buf,42) = (((p->hp) < ( +# 1869 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1869 "../../../server-code/src/char/char.c" + )) ? (p->hp) : ( +# 1869 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1869 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,44) = (((p->max_hp) < ( +# 1870 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1870 "../../../server-code/src/char/char.c" + )) ? (p->max_hp) : ( +# 1870 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1870 "../../../server-code/src/char/char.c" + )); + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; +# 1934 "../../../server-code/src/char/char.c" + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + + + + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + + + + chr->mmo_char_send_characters(i, sd); + + + + + + + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + + + WFIFOL(fd,10) = (int)delete_date; + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + + + + + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); +# 4465 "../../../server-code/src/char/char.c" + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + + + RFIFOSKIP(fd,37); + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; +# 4672 "../../../server-code/src/char/char.c" + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + + + chr->mmo_char_send_characters(fd, sd); + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; +# 5019 "../../../server-code/src/char/char.c" + case 0x67: + { + do { if(RFIFOREST(fd) < (37)) return 0; if (sd== +# 5021 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5021 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(37)); return 0; } } while (0); + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/00000000/src/clif.c b/servergreps/hercules/00000000/src/clif.c new file mode 100644 index 0000000..e512c0b --- /dev/null +++ b/servergreps/hercules/00000000/src/clif.c @@ -0,0 +1,43876 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, + + + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + + + + + int8 HERC__unavailable_struct; + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; +# 96 "../../../server-code/src/map/clif.c" +static inline int itemtype(int type) { + switch( type ) { + + + + + + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + *rhand = sd->status.weapon; + *lhand = sd->status.shield; +# 895 "../../../server-code/src/map/clif.c" +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit2 p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 932 "../../../server-code/src/map/clif.c" 3 4 +0 +# 932 "../../../server-code/src/map/clif.c" +)) return; } while(0); + sd = ( ((bl) == (struct block_list *) +# 933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 933 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 933 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unit2Type; + + + + p.GID = bl->id; + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 943 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.shield = vd->shield; + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.shield = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( !pc->db_checkid(vd->class_) ) { + clif->set_unit_idle2(bl,tsd,target); + return; + } + + + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; +# 1005 "../../../server-code/src/map/clif.c" + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + p.shield = vd->shield; + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); +# 1061 "../../../server-code/src/map/clif.c" + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + + + + p.GID = -bl->id; + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { + + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit2 p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1083 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1083 "../../../server-code/src/map/clif.c" +)) return; } while(0); + sd = ( ((bl) == (struct block_list *) +# 1084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unit2Type; + + + + p.GID = bl->id; + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1094 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.job = vd->class_; + p.shield = vd->shield; + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.shield = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + + clif->send(&p,sizeof(p),bl,target); + + + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( !pc->db_checkid(vd->class_) ) { + clif->spawn_unit2(bl,target); + return; + } + + + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; +# 1147 "../../../server-code/src/map/clif.c" + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + p.shield = vd->shield; + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); +# 1201 "../../../server-code/src/map/clif.c" + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + + + + p.GID = -bl->id; + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; +# 1243 "../../../server-code/src/map/clif.c" + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + p.shield = vd->shield; + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); +# 1294 "../../../server-code/src/map/clif.c" + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + + + + p.GID = -bl->id; + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + + + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + clif->dropitem(sd,n,amount); +# 2432 "../../../server-code/src/map/clif.c" +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + p->IsIdentified = i->identify ? 1 : 0; + + + p->location = eqp_pos; + p->WearState = i->equip; + + p->IsDamaged = i->attribute ? 1 : 0; + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + p->IsIdentified = i->identify ? 1 : 0; + + + p->count = i->amount; + p->WearState = id->equip; +# 2552 "../../../server-code/src/map/clif.c" +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + const int cmd = 0x106; + + + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; + + if( sd->battle_status.max_hp > +# 2792 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 2792 "../../../server-code/src/map/clif.c" + ) + { + WFIFOW(tsd->fd,6) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WFIFOW(tsd->fd,8) = 100; + } else { + WFIFOW(tsd->fd,6) = sd->battle_status.hp; + WFIFOW(tsd->fd,8) = sd->battle_status.max_hp; + } + + + + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: +# 3178 "../../../server-code/src/map/clif.c" + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + return; + + + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + clif->sendlook(bl, bl->id, type, val, 0, target); +# 3218 "../../../server-code/src/map/clif.c" +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + WBUFW(buf,0)=0xc3; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFB(buf,7)=val; + clif->send(buf,packet_db[0xc3].len,bl,target); +# 3245 "../../../server-code/src/map/clif.c" +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + + + + + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); +# 3507 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x119; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3511 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3511 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,12) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x119].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x119].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFW(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x119].len,bl,SELF); + } else + clif->send(buf,packet_db[0x119].len,bl,AREA); + +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { + + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); +# 3589 "../../../server-code/src/map/clif.c" + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xe5].len); + WFIFOW(fd,0) = 0xe5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0xe5].len); +# 3851 "../../../server-code/src/map/clif.c" +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; +# 3884 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + WBUFL(buf,2) = amount; + WBUFW(buf,6) = 0; + + + + + + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + WBUFL(buf,2) = amount; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,6) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,6) = sd->status.inventory[index].nameid; +# 3944 "../../../server-code/src/map/clif.c" + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + + + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + short damage,damage2; + + + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + damage = (short)(((in_damage) < ( +# 4300 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4300 "../../../server-code/src/map/clif.c" + )) ? (in_damage) : ( +# 4300 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4300 "../../../server-code/src/map/clif.c" + )); + damage2 = (short)(((in_damage2) < ( +# 4301 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4301 "../../../server-code/src/map/clif.c" + )) ? (in_damage2) : ( +# 4301 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4301 "../../../server-code/src/map/clif.c" + )); + + + + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; +# 4502 "../../../server-code/src/map/clif.c" + p.PacketType = skill_entryType; + + + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + + + + p.isVisible = 1; + + + + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ +# 4806 "../../../server-code/src/map/clif.c" + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + const int cmd = 0x13e; + + + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ +# 4998 "../../../server-code/src/map/clif.c" +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } + + + WBUFW(buf,0) = 0x114; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFW(buf,24) = damage ? div : 0; + } else { + WBUFW(buf,24) = damage; + } + WBUFW(buf,26) = skill_lv; + WBUFW(buf,28) = div; + WBUFB(buf, 30) = type; + if (disguised(dst)) { + clif->send(buf, packet_db[0x114].len, dst, AREA_WOS); + WBUFL(buf, 8) = -dst->id; + clif->send(buf, packet_db[0x114].len, dst, SELF); + } else + clif->send(buf, packet_db[0x114].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFW(buf,24) = -1; + clif->send(buf, packet_db[0x114].len, src, SELF); + } +# 5096 "../../../server-code/src/map/clif.c" + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; +# 5482 "../../../server-code/src/map/clif.c" + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + WFIFOHEAD(fd, mes_len + (23 + 1) + 4); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + (strlib->safestrncpy_((WFIFOP(fd,28)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); +# 5828 "../../../server-code/src/map/clif.c" +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + + + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + const int cmd = 0x133; + const int offset = 8; +# 6220 "../../../server-code/src/map/clif.c" + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + const int cmd = 0xfe; + + + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + + if( result == 7 ) { + clif->message(fd, atcommand->msgsd((sd),(3))); + return; + } + + + + WFIFOHEAD(fd,packet_db[0xfd].len); + WFIFOW(fd,0) = 0xfd; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOB(fd,26) = result; + WFIFOSET(fd,packet_db[0xfd].len); + + + + + + + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + const int cmd = 0x101; + + + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + + + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + const int cmd = 0x106; + + + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; + + if (sd->battle_status.max_hp > +# 6684 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 6684 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,6) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,8) = 100; + } else { + WBUFW(buf,6) = sd->battle_status.hp; + WBUFW(buf,8) = sd->battle_status.max_hp; + } + + + + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + const int cmd = 0x106; + + + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; + + if( maxhp > +# 6712 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 6712 "../../../server-code/src/map/clif.c" + ) + { + WFIFOW(fd,6) = hp/(maxhp/100); + WFIFOW(fd,8) = 100; + } else { + WFIFOW(fd,6) = hp; + WFIFOW(fd,8) = maxhp; + } + + + + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + const unsigned short cmd = 0x15c; + + + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + memset(WBUFP(buf,66), 0, (23 + 1)); + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + const int offset = (23 + 1)*2+40; + + + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + memset(WFIFOP(fd,4 + c*offset+24), 0, (23 + 1)); + memcpy(WFIFOP(fd,4 + c*offset+48), e->mes, 40); + + + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.option&OPTION_CART )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ +# 8848 "../../../server-code/src/map/clif.c" +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = sd->bl.id; + WFIFOSET(fd,4); + + + + + + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); + clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); + + + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.option&OPTION_CART )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + + + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); +# 9480 "../../../server-code/src/map/clif.c" +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { +# 9529 "../../../server-code/src/map/clif.c" +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { +# 9554 "../../../server-code/src/map/clif.c" +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.option&OPTION_CART )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.option&OPTION_CART )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + + + + pc->setoption(sd,sd->sc.option&~OPTION_CART); + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); +# 10902 "../../../server-code/src/map/clif.c" + if( (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.option&OPTION_CART )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.option&OPTION_CART )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + party->changeoption(sd, RFIFOL(fd,2), p->party.item); + + + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + reply = RFIFOB(fd,10); + + + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { + + switch( type ) { + case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; + case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; + case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break; + } +# 14193 "../../../server-code/src/map/clif.c" +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + const int offset = 8; + + + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + WFIFOW(fd,6) = TOW(error); + + + + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + short nameid = RFIFOW(fd,2); + short amount = RFIFOW(fd,4); + int points = RFIFOL(fd,6); + + fail = npc->cashshop_buy(sd, nameid, amount, points); +# 15494 "../../../server-code/src/map/clif.c" + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ +# 15874 "../../../server-code/src/map/clif.c" +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ +# 16279 "../../../server-code/src/map/clif.c" +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ +# 16411 "../../../server-code/src/map/clif.c" +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { +# 17150 "../../../server-code/src/map/clif.c" +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ +# 17319 "../../../server-code/src/map/clif.c" + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { +# 17391 "../../../server-code/src/map/clif.c" +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { +# 17680 "../../../server-code/src/map/clif.c" +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + + + const int offset = 6; + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + + + WFIFOW(fd,0) = 0x43e; + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + + + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->duration; + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + short damage; + + + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + damage = (short)(((in_damage) < ( +# 18150 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 18150 "../../../server-code/src/map/clif.c" + )) ? (in_damage) : ( +# 18150 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 18150 "../../../server-code/src/map/clif.c" + )); + + + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +# 18225 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ +# 18268 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ +# 18298 "../../../server-code/src/map/clif.c" +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/00000000/src/login.c b/servergreps/hercules/00000000/src/login.c new file mode 100644 index 0000000..adead10 --- /dev/null +++ b/servergreps/hercules/00000000/src/login.c @@ -0,0 +1,9126 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, + + + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + + + + + int8 HERC__unavailable_struct; + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); +# 1380 "../../../server-code/src/login/login.c" + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = (uint8)result; + if( result != 6 ) + memset(WFIFOP(fd,3), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,3), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,23); + +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/00000000/uselesspackets.txt b/servergreps/hercules/00000000/uselesspackets.txt new file mode 100644 index 0000000..f4586b4 --- /dev/null +++ b/servergreps/hercules/00000000/uselesspackets.txt @@ -0,0 +1,113 @@ +Useless packet 084a. +Useless packet 07f5. +Useless packet 0232. +Useless packet 0231. +Useless packet 0234. +Useless packet 0835. +Useless packet 0a01. +Useless packet 0838. +Useless packet 08e0. +Useless packet 09a9. +Useless packet 02f1. +Useless packet 08fc. +Useless packet 0200. +Useless packet 083c. +Useless packet 083b. +Useless packet 0844. +Useless packet 0846. +Useless packet 0998. +Useless packet 023f. +Useless packet 0439. +Useless packet 0233. +Useless packet 08d4. +Useless packet 0436. +Useless packet 029f. +Useless packet 02b6. +Useless packet 090a. +Useless packet 024e. +Useless packet 024b. +Useless packet 0437. +Useless packet 0288. +Useless packet 0360. +Useless packet 02d6. +Useless packet 035f. +Useless packet 02d8. +Useless packet 7530. +Useless packet 085b. +Useless packet 09b8. +Useless packet 0907. +Useless packet 09b6. +Useless packet 088a. +Useless packet 02db. +Useless packet 09d8. +Useless packet 0292. +Useless packet 09d4. +Useless packet 09d6. +Useless packet 0212. +Useless packet 028f. +Useless packet 091a. +Useless packet 0273. +Useless packet 0970. +Useless packet 024c. +Useless packet 024f. +Useless packet 024d. +Useless packet 07ec. +Useless packet 0871. +Useless packet 0241. +Useless packet 0066. +Useless packet 0187. +Useless packet 08ba. +Useless packet 0064. +Useless packet 0065. +Useless packet 0061. +Useless packet 0068. +Useless packet 07e4. +Useless packet 020f. +Useless packet 0246. +Useless packet 0247. +Useless packet 0244. +Useless packet 0a35. +Useless packet 027c. +Useless packet 02ba. +Useless packet 0801. +Useless packet 0940. +Useless packet 02c8. +Useless packet 09a7. +Useless packet 02c7. +Useless packet 0b07. +Useless packet 0243. +Useless packet 0251. +Useless packet 0b09. +Useless packet 097c. +Useless packet 022d. +Useless packet 0368. +Useless packet 0819. +Useless packet 0361. +Useless packet 0815. +Useless packet 0362. +Useless packet 08c9. +Useless packet 0811. +Useless packet 0366. +Useless packet 08da. +Useless packet 0b11. +Useless packet 0b13. +Useless packet 0b12. +Useless packet 0b15. +Useless packet 0b14. +Useless packet 095d. +Useless packet 0b0f. +Useless packet 0b0d. +Useless packet 0b0e. +Useless packet 0b0c. +Useless packet 07da. +Useless packet 025d. +Useless packet 025c. +Useless packet 025b. +Useless packet 089c. +Useless packet 08d7. +Useless packet 09ab. +Useless packet 0213. +Useless packet 0222. +Useless packet 0248. +Useless packet 0980. +Useless packet 0817. diff --git a/servergreps/hercules/00000007/serverpackets.txt b/servergreps/hercules/00000007/serverpackets.txt index f3a092d..2f97b3f 100644 --- a/servergreps/hercules/00000007/serverpackets.txt +++ b/servergreps/hercules/00000007/serverpackets.txt @@ -52,7 +52,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -71,7 +70,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED e9 client name: SMSG_TRADE_ITEM_ADD ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE @@ -99,10 +97,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -160,7 +155,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -208,8 +202,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -270,7 +262,6 @@ fe client name: SMSG_PARTY_INVITED 25f 260 274 -283 284 287 289 @@ -291,12 +282,8 @@ fe client name: SMSG_PARTY_INVITED 2b4 2b5 2b7 -2b8 -2b9 2bb 2c1 -2c5 -2c6 2c9 2cb 2cc @@ -311,36 +298,24 @@ fe client name: SMSG_PARTY_INVITED 2de 2df 2e0 -2ef 2f0 2f2 -43d 43e 43f -440 -441 442 -446 -7d8 7e1 -7e2 -7e3 7e6 7e9 7f6 -7fa -7fb 7fc client name: SMSG_PARTY_LEADER 7fd client name: SMSG_ITEM_MVP_DROPPED 7fe -800 803 805 807 809 80a 80b -80e 810 812 813 @@ -361,12 +336,10 @@ fe client name: SMSG_PARTY_INVITED 837 83a 83d -83e 840 client name: SMSG_MAP_NOT_FOUND 845 client name: SMSG_NPC_CASH_POINTS 849 client name: SMSG_NPC_CASH_BUY 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8ca client name: SMSG_NPC_CASH_SCHEDULE 8cf @@ -377,54 +350,29 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 -8e8 -8ea -8ec -8ed -8ee -8f2 -8fa 908 -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 97d client name: SMSG_RANKS_LIST -97e -97f -985 -99b 99d client name: SMSG_CHAR_CHARACTERS 9a6 9a8 9aa -9d5 -9d7 a02 a1a a1c a20 a22 -a28 -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -434,184 +382,26 @@ a28 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 status_changetype diff --git a/servergreps/hercules/00000007/src/char.c b/servergreps/hercules/00000007/src/char.c new file mode 100644 index 0000000..486575e --- /dev/null +++ b/servergreps/hercules/00000007/src/char.c @@ -0,0 +1,16246 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, + + + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + + + + + int8 HERC__unavailable_struct; + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } +# 684 "../../../server-code/src/char/char.c" + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + + + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); +# 1310 "../../../server-code/src/char/char.c" + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + + + if((slot < 0 || slot >= sd->char_slots) + || (str + agi + vit + int_ + dex + luk != 6*5 ) + || (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) + || (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) + + + + + return -2; + + + + if( sd->found_char[slot] != -1 ) + return -2; +# 1583 "../../../server-code/src/char/char.c" + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1588, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1588, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1590)); + return -2; + } + + + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); +# 1767 "../../../server-code/src/char/char.c" + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + + + + + + WBUFW(buf,42) = (((p->hp) < ( +# 1869 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1869 "../../../server-code/src/char/char.c" + )) ? (p->hp) : ( +# 1869 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1869 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,44) = (((p->max_hp) < ( +# 1870 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1870 "../../../server-code/src/char/char.c" + )) ? (p->max_hp) : ( +# 1870 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1870 "../../../server-code/src/char/char.c" + )); + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; +# 1934 "../../../server-code/src/char/char.c" + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + + + + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + + + + chr->mmo_char_send_characters(i, sd); + + + + + + + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + + + WFIFOL(fd,10) = (int)delete_date; + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + + + + + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); +# 4465 "../../../server-code/src/char/char.c" + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + + + RFIFOSKIP(fd,37); + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; +# 4672 "../../../server-code/src/char/char.c" + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + + + chr->mmo_char_send_characters(fd, sd); + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; +# 5019 "../../../server-code/src/char/char.c" + case 0x67: + { + do { if(RFIFOREST(fd) < (37)) return 0; if (sd== +# 5021 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5021 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(37)); return 0; } } while (0); + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/00000007/src/clif.c b/servergreps/hercules/00000007/src/clif.c new file mode 100644 index 0000000..30d7a27 --- /dev/null +++ b/servergreps/hercules/00000007/src/clif.c @@ -0,0 +1,43984 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, + + + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + + + + + int8 HERC__unavailable_struct; + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; +# 96 "../../../server-code/src/map/clif.c" +static inline int itemtype(int type) { + switch( type ) { + + + + + + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit2 p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 932 "../../../server-code/src/map/clif.c" 3 4 +0 +# 932 "../../../server-code/src/map/clif.c" +)) return; } while(0); + sd = ( ((bl) == (struct block_list *) +# 933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 933 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 933 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unit2Type; + + + + p.GID = bl->id; + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 943 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.shield = vd->shield; + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.shield = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( !pc->db_checkid(vd->class_) ) { + clif->set_unit_idle2(bl,tsd,target); + return; + } + + + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; +# 1005 "../../../server-code/src/map/clif.c" + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); +# 1061 "../../../server-code/src/map/clif.c" + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + + + + p.GID = -bl->id; + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { + + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit2 p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1083 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1083 "../../../server-code/src/map/clif.c" +)) return; } while(0); + sd = ( ((bl) == (struct block_list *) +# 1084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unit2Type; + + + + p.GID = bl->id; + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1094 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.job = vd->class_; + p.shield = vd->shield; + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.shield = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + + clif->send(&p,sizeof(p),bl,target); + + + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( !pc->db_checkid(vd->class_) ) { + clif->spawn_unit2(bl,target); + return; + } + + + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; +# 1147 "../../../server-code/src/map/clif.c" + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); +# 1201 "../../../server-code/src/map/clif.c" + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + + + + p.GID = -bl->id; + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; +# 1243 "../../../server-code/src/map/clif.c" + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); +# 1294 "../../../server-code/src/map/clif.c" + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + + + + p.GID = -bl->id; + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + + + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + clif->dropitem(sd,n,amount); +# 2432 "../../../server-code/src/map/clif.c" +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + p->IsIdentified = i->identify ? 1 : 0; + + + p->location = eqp_pos; + p->WearState = i->equip; + + p->IsDamaged = i->attribute ? 1 : 0; + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + p->IsIdentified = i->identify ? 1 : 0; + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); +# 2552 "../../../server-code/src/map/clif.c" +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + const int cmd = 0x106; + + + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; + + if( sd->battle_status.max_hp > +# 2792 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 2792 "../../../server-code/src/map/clif.c" + ) + { + WFIFOW(tsd->fd,6) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WFIFOW(tsd->fd,8) = 100; + } else { + WFIFOW(tsd->fd,6) = sd->battle_status.hp; + WFIFOW(tsd->fd,8) = sd->battle_status.max_hp; + } + + + + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + return; + + + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + + + + + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + WBUFL(buf,2) = amount; + WBUFW(buf,6) = 0; + + + + + + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + WBUFL(buf,2) = amount; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,6) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,6) = sd->status.inventory[index].nameid; +# 3944 "../../../server-code/src/map/clif.c" + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + short damage,damage2; + + + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + damage = (short)(((in_damage) < ( +# 4300 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4300 "../../../server-code/src/map/clif.c" + )) ? (in_damage) : ( +# 4300 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4300 "../../../server-code/src/map/clif.c" + )); + damage2 = (short)(((in_damage2) < ( +# 4301 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4301 "../../../server-code/src/map/clif.c" + )) ? (in_damage2) : ( +# 4301 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 4301 "../../../server-code/src/map/clif.c" + )); + + + + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + + + + p.isVisible = 1; + + + + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ +# 4806 "../../../server-code/src/map/clif.c" + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + const int cmd = 0x13e; + + + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ +# 4998 "../../../server-code/src/map/clif.c" +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + WBUFB(buf, 32) = type; + + + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; +# 5482 "../../../server-code/src/map/clif.c" + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + WFIFOHEAD(fd, mes_len + (23 + 1) + 4); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + (strlib->safestrncpy_((WFIFOP(fd,28)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); +# 5828 "../../../server-code/src/map/clif.c" +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + const int cmd = 0x133; + const int offset = 8; +# 6220 "../../../server-code/src/map/clif.c" + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + const int cmd = 0xfe; + + + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + + if( result == 7 ) { + clif->message(fd, atcommand->msgsd((sd),(3))); + return; + } + + + + WFIFOHEAD(fd,packet_db[0xfd].len); + WFIFOW(fd,0) = 0xfd; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOB(fd,26) = result; + WFIFOSET(fd,packet_db[0xfd].len); + + + + + + + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + const int cmd = 0x101; + + + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + + + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + const int cmd = 0x106; + + + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; + + if (sd->battle_status.max_hp > +# 6684 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 6684 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,6) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,8) = 100; + } else { + WBUFW(buf,6) = sd->battle_status.hp; + WBUFW(buf,8) = sd->battle_status.max_hp; + } + + + + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + const int cmd = 0x106; + + + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; + + if( maxhp > +# 6712 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 6712 "../../../server-code/src/map/clif.c" + ) + { + WFIFOW(fd,6) = hp/(maxhp/100); + WFIFOW(fd,8) = 100; + } else { + WFIFOW(fd,6) = hp; + WFIFOW(fd,8) = maxhp; + } + + + + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + const unsigned short cmd = 0x15c; + + + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + memset(WBUFP(buf,66), 0, (23 + 1)); + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + const int offset = (23 + 1)*2+40; + + + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + memset(WFIFOP(fd,4 + c*offset+24), 0, (23 + 1)); + memcpy(WFIFOP(fd,4 + c*offset+48), e->mes, 40); + + + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.option&OPTION_CART )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ +# 8848 "../../../server-code/src/map/clif.c" +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = sd->bl.id; + WFIFOSET(fd,4); + + + + + + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.option&OPTION_CART )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + + + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); +# 9480 "../../../server-code/src/map/clif.c" +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { +# 9529 "../../../server-code/src/map/clif.c" +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { +# 9554 "../../../server-code/src/map/clif.c" +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.option&OPTION_CART )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.option&OPTION_CART )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + + + + pc->setoption(sd,sd->sc.option&~OPTION_CART); + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); +# 10902 "../../../server-code/src/map/clif.c" + if( (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.option&OPTION_CART )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.option&OPTION_CART )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + party->changeoption(sd, RFIFOL(fd,2), p->party.item); + + + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { + + switch( type ) { + case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; + case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; + case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break; + } +# 14193 "../../../server-code/src/map/clif.c" +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + const int offset = 8; + + + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + WFIFOW(fd,6) = TOW(error); + + + + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + short nameid = RFIFOW(fd,2); + short amount = RFIFOW(fd,4); + int points = RFIFOL(fd,6); + + fail = npc->cashshop_buy(sd, nameid, amount, points); +# 15494 "../../../server-code/src/map/clif.c" + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ +# 15874 "../../../server-code/src/map/clif.c" +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ +# 16279 "../../../server-code/src/map/clif.c" +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ +# 16411 "../../../server-code/src/map/clif.c" +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { +# 17150 "../../../server-code/src/map/clif.c" +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ +# 17319 "../../../server-code/src/map/clif.c" + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { +# 17391 "../../../server-code/src/map/clif.c" +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { +# 17680 "../../../server-code/src/map/clif.c" +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + + + const int offset = 6; + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + + + WFIFOW(fd,0) = 0x43e; + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + + + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->duration; + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + short damage; + + + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + damage = (short)(((in_damage) < ( +# 18150 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 18150 "../../../server-code/src/map/clif.c" + )) ? (in_damage) : ( +# 18150 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 18150 "../../../server-code/src/map/clif.c" + )); + + + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +# 18225 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ +# 18268 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ +# 18298 "../../../server-code/src/map/clif.c" +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/00000007/src/login.c b/servergreps/hercules/00000007/src/login.c new file mode 100644 index 0000000..adead10 --- /dev/null +++ b/servergreps/hercules/00000007/src/login.c @@ -0,0 +1,9126 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, + + + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + + + + + int8 HERC__unavailable_struct; + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); +# 1380 "../../../server-code/src/login/login.c" + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = (uint8)result; + if( result != 6 ) + memset(WFIFOP(fd,3), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,3), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,23); + +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20120700/clientpackets.txt b/servergreps/hercules/20120700/clientpackets.txt new file mode 100644 index 0000000..270e4eb --- /dev/null +++ b/servergreps/hercules/20120700/clientpackets.txt @@ -0,0 +1,32 @@ +UNIMPLIMENTED CMSG_PARTY_CREATE2 +UNIMPLIMENTED CMSG_PARTY_INVITED +00a9 6 clif->pEquipItem +013f 26 clif->pGM_Monster_Item +0217 2 clif->pBlacksmith +0218 2 clif->pAlchemist +021d 6 clif->pLessEffect +0225 2 clif->pTaekwon +0237 2 clif->pRankingPk +0254 3 clif->pFeelSaveOk +0438 10 clif->pUseSkillToPos +0443 8 clif->pSkillSelectMenu +0804 14 clif->pPartyBookingSearchReq +0806 2 clif->pPartyBookingDeleteReq +0808 14 clif->pPartyBookingUpdateReq +0842 6 clif->pGMRecall2 +0843 6 clif->pGMRemove2 +0848 -1 clif->pCashShopBuy +08aa 7 clif->pActionRequest +08e5 41 clif->pPartyRecruitRegisterReq +08e7 10 clif->pPartyRecruitSearchReq +08e9 2 clif->pPartyRecruitDeleteReq +08eb 39 clif->pPartyRecruitUpdateReq +08fb 6 clif->pDull +0916 26 clif->pGuildInvite2 +091d 18 clif->pPartyBookingRegisterReq +0929 26 clif->pPartyInvite2 +0945 -1 clif->pItemListWindowSelected +0961 36 clif->pStoragePassword +0963 8 clif->pMoveFromKafra +096e -1 clif->ackmergeitems +0974 2 clif->cancelmergeitem diff --git a/servergreps/hercules/20120700/serverpackets.txt b/servergreps/hercules/20120700/serverpackets.txt new file mode 100644 index 0000000..ee3573c --- /dev/null +++ b/servergreps/hercules/20120700/serverpackets.txt @@ -0,0 +1,419 @@ +j +69 client name: SMSG_LOGIN_DATA +6a client name: SMSG_LOGIN_ERROR +6b client name: SMSG_CHAR_LOGIN +6c client name: SMSG_CHAR_LOGIN_ERROR +6d client name: SMSG_CHAR_CREATE_SUCCEEDED +6e client name: SMSG_CHAR_CREATE_FAILED +6f client name: SMSG_CHAR_DELETE_SUCCEEDED +70 client name: SMSG_CHAR_DELETE_FAILED +71 client name: SMSG_CHAR_MAP_INFO +74 client name: SMSG_MAP_AUTH_REFUSE +78 client name: SMSG_BEING_FAKE_NAME +7f client name: SMSG_SERVER_PING +80 client name: SMSG_BEING_REMOVE +81 client name: SMSG_CONNECTION_PROBLEM +86 client name: SMSG_BEING_MOVE2 +87 client name: SMSG_WALK_RESPONSE +88 client name: SMSG_PLAYER_STOP +8a client name: SMSG_BEING_ACTION +8d client name: SMSG_BEING_CHAT +8e client name: SMSG_PLAYER_CHAT +91 client name: SMSG_PLAYER_WARP +92 client name: SMSG_CHANGE_MAP_SERVER +95 client name: SMSG_BEING_NAME_RESPONSE +97 client name: SMSG_WHISPER +98 client name: SMSG_WHISPER_RESPONSE +9a client name: SMSG_GM_CHAT +9c client name: SMSG_BEING_CHANGE_DIRECTION +9d client name: SMSG_ITEM_VISIBLE +9e client name: SMSG_ITEM_DROPPED +a1 client name: SMSG_ITEM_REMOVE +a8 client name: SMSG_ITEM_USE_RESPONSE +aa client name: SMSG_PLAYER_EQUIP +ac client name: SMSG_PLAYER_UNEQUIP +af client name: SMSG_PLAYER_INVENTORY_REMOVE +b0 client name: SMSG_PLAYER_STAT_UPDATE_1 +b1 client name: SMSG_PLAYER_STAT_UPDATE_2 +b3 client name: SMSG_CHAR_SWITCH_RESPONSE +b4 client name: SMSG_NPC_MESSAGE +b5 client name: SMSG_NPC_NEXT +b6 client name: SMSG_NPC_CLOSE +b7 client name: SMSG_NPC_CHOICE +bc client name: SMSG_PLAYER_STAT_UPDATE_4 +bd client name: SMSG_PLAYER_STAT_UPDATE_5 +be client name: SMSG_PLAYER_STAT_UPDATE_6 +c0 client name: SMSG_BEING_EMOTION +c2 client name: SMSG_WHO_ANSWER +c4 client name: SMSG_NPC_BUY_SELL_CHOICE +c6 client name: SMSG_NPC_BUY +c7 client name: SMSG_NPC_SELL +ca client name: SMSG_NPC_BUY_RESPONSE +cb client name: SMSG_NPC_SELL_RESPONSE +cd client name: SMSG_ADMIN_KICK_ACK +d1 client name: SMSG_IGNORE_NICK_ACK +d2 client name: SMSG_IGNORE_ALL_RESPONSE +d4 client name: SMSG_CHAT_IGNORE_LIST +d6 client name: SMSG_CHAT_ROOM_CREATE_ACK +d7 client name: SMSG_CHAT_DISPLAY +d8 client name: SMSG_CHAT_ROOM_DESTROY +da client name: SMSG_CHAT_ROOM_JOIN_FAILED +db client name: SMSG_CHAT_ROOM_JOIN_ACK +dc client name: SMSG_CHAT_ROOM_ADD_MEMBER +dd client name: SMSG_CHAT_ROOM_LEAVE +df client name: SMSG_CHAT_ROOM_SETTINGS +e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE +e7 client name: SMSG_TRADE_RESPONSE_OUTDATED +ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE +ec client name: SMSG_TRADE_OK +ee client name: SMSG_TRADE_CANCEL +f0 client name: SMSG_TRADE_COMPLETE +f1 client name: SMSG_TRADE_UNDO +f2 client name: SMSG_PLAYER_STORAGE_STATUS +f6 client name: SMSG_PLAYER_STORAGE_REMOVE +f8 client name: SMSG_PLAYER_STORAGE_CLOSE +fa client name: SMSG_PARTY_CREATE +fb client name: SMSG_PARTY_INFO +105 client name: SMSG_PARTY_LEAVE +107 client name: SMSG_PARTY_UPDATE_COORDS +109 client name: SMSG_PARTY_MESSAGE +10a client name: SMSG_MVP_ITEM +10b client name: SMSG_MVP_EXP +10c client name: SMSG_MVP_EFFECT +10d client name: SMSG_MVP_NO_ITEM +10e client name: SMSG_PLAYER_SKILL_UP +10f client name: SMSG_PLAYER_SKILLS +110 client name: SMSG_SKILL_FAILED +111 client name: SMSG_PLAYER_ADD_SKILL +117 client name: SMSG_SKILL_GROUND_NO_DAMAGE +11a client name: SMSG_SKILL_NO_DAMAGE +11c client name: SMSG_SKILL_WARP_POINT +11e client name: SMSG_SKILL_MEMO_MESSAGE +120 client name: SMSG_BEING_REMOVE_SKILL +121 client name: SMSG_CART_INFO +125 client name: SMSG_PLAYER_CART_REMOVE +12b client name: SMSG_CART_REMOVE +12c client name: SMSG_PLAYER_CART_ADD_ERROR +12d client name: SMSG_VENDING_OPEN_REQ +131 client name: SMSG_VENDING_SHOW_BOARD +132 client name: SMSG_VENDING_HIDE_BOARD +135 client name: SMSG_VENDING_BUY_ACK +136 client name: SMSG_VENDING_OPEN +137 client name: SMSG_VENDING_REPORT +139 client name: SMSG_PLAYER_MOVE_TO_ATTACK +13a client name: SMSG_PLAYER_ATTACK_RANGE +13b client name: SMSG_PLAYER_ARROW_MESSAGE +13c client name: SMSG_PLAYER_ARROW_EQUIP +13d client name: SMSG_PLAYER_HEAL +141 client name: SMSG_PLAYER_STAT_UPDATE_3 +142 client name: SMSG_NPC_INT_INPUT +144 client name: SMSG_NPC_VIEWPOINT +147 client name: SMSG_SKILL_AUTO_CAST +148 client name: SMSG_BEING_RESURRECT +14a client name: SMSG_MANNER_MESSAGE +14b client name: SMSG_CHAT_SILENCE +14c client name: SMSG_GUILD_ALIANCE_INFO +14e client name: SMSG_GUILD_MASTER_OR_MEMBER +152 client name: SMSG_GUILD_EMBLEM_DATA +154 client name: SMSG_GUILD_MEMBER_LIST +156 client name: SMSG_GUILD_MEMBER_POS_CHANGE +15a client name: SMSG_GUILD_LEAVE +15e client name: SMSG_GUILD_BROKEN +160 client name: SMSG_GUILD_POS_INFO_LIST +162 client name: SMSG_GUILD_SKILL_INFO +163 client name: SMSG_GUILD_EXPULSION_LIST +166 client name: SMSG_GUILD_POS_NAME_LIST +167 client name: SMSG_GUILD_CREATE_RESPONSE +169 client name: SMSG_GUILD_INVITE_ACK +16a client name: SMSG_GUILD_INVITE +16c client name: SMSG_GUILD_POSITION_INFO +16f client name: SMSG_GUILD_NOTICE +171 client name: SMSG_GUILD_REQ_ALLIANCE +173 client name: SMSG_GUILD_REQ_ALLIANCE_ACK +174 client name: SMSG_GUILD_POSITION_CHANGED +177 client name: SMSG_PLAYER_IDENTIFY_LIST +179 client name: SMSG_PLAYER_IDENTIFIED +17b client name: SMSG_PLAYER_USE_CARD +17d client name: SMSG_PLAYER_INSERT_CARD +17f client name: SMSG_GUILD_MESSAGE +181 client name: SMSG_GUILD_OPPOSITION_ACK +184 client name: SMSG_GUILD_DEL_ALLIANCE +188 client name: SMSG_PLAYER_REFINE +189 client name: SMSG_PLAYER_NOTIFY_MAPINFO +18b client name: SMSG_MAP_QUIT_RESPONSE +18c client name: SMSG_MONSTER_INFO +18d client name: SMSG_PLAYER_SKILL_PRODUCE_MIX_LIST +18f client name: SMSG_PLAYER_SKILL_PRODUCE_EFFECT +191 client name: SMSG_CHAT_TALKIE_BOX +192 client name: SMSG_ADMIN_SET_TILE_TYPE +194 client name: SMSG_SOLVE_CHAR_NAME +196 client name: SMSG_BEING_STATUS_CHANGE +199 client name: SMSG_PVP_MAP_MODE +19a client name: SMSG_PVP_SET +19b client name: SMSG_BEING_SELFEFFECT +19e client name: SMSG_PET_CATCH_PROCESS +1a0 client name: SMSG_PET_ROULETTE +1a2 client name: SMSG_PET_STATUS +1a3 client name: SMSG_PET_FOOD +1a4 client name: SMSG_PET_DATA +1a6 client name: SMSG_PET_EGGS_LIST +1aa client name: SMSG_PET_MESSAGE +1ab client name: SMSG_BEING_STAT_UPDATE_1 +1ac client name: SMSG_SKILL_UNIT_UPDATE +1ad client name: SMSG_SKILL_ARROW_CREATE_LIST +1b0 client name: SMSG_CLASS_CHANGE +1b1 client name: SMSG_NPC_SHOW_DIGIT +1b3 client name: SMSG_NPC_CUTIN +1b4 client name: SMSG_GUILD_EMBLEM +1b6 client name: SMSG_GUILD_BASIC_INFO +1b9 client name: SMSG_SKILL_CAST_CANCEL +1c3 client name: SMSG_GM_CHAT2 +1c4 client name: SMSG_PLAYER_STORAGE_ADD +1c5 client name: SMSG_PLAYER_CART_ADD +1c8 client name: SMSG_PLAYER_INVENTORY_USE +1c9 client name: SMSG_GRAFFITI_VISIBLE +1cd client name: SMSG_PLAYER_SKILL_AUTO_SPELLS +1cf client name: SMSG_SKILL_DEVOTION_EFFECT +1d0 client name: SMSG_SPIRIT_BALLS +1d1 client name: SMSG_BLADE_STOP +1d2 client name: SMSG_COMBO_DELAY +1d3 client name: SMSG_BEING_SOUND_EFFECT +1d4 client name: SMSG_NPC_STR_INPUT +1d6 client name: SMSG_MAP_TYPE +1d7 client name: SMSG_BEING_CHANGE_LOOKS2 +1dc client name: SMSG_LOGIN_CODING_KEY +1de client name: SMSG_SKILL_DAMAGE +1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK +1e1 client name: SMSG_SPIRIT_BALL_SINGLE +1e6 client name: SMSG_FAMILY_CALL_PARTNER +1e9 client name: SMSG_PARTY_MEMBER_INFO +1ea client name: SMSG_WEDDING_EFFECT +1eb client name: SMSG_GUILD_UPDATE_COORDS +1f2 client name: SMSG_GUILD_MEMBER_LOGIN +1f3 client name: SMSG_BEING_SPECIAL_EFFECT +1f4 client name: SMSG_TRADE_REQUEST +1f5 client name: SMSG_TRADE_RESPONSE +1f6 client name: SMSG_FAMILY_ASK_FOR_CHILD +1fc client name: SMSG_PLAYER_REPAIR_LIST +1fe client name: SMSG_PLAYER_REPAIR_EFFECT +1ff client name: SMSG_BEING_SLIDE +201 client name: SMSG_FRIENDS_LIST +205 client name: SMSG_FAMILY_DIVORCED +206 client name: SMSG_FRIENDS_PLAYER_ONLINE +207 client name: SMSG_FRIENDS_REQUEST +209 client name: SMSG_FRIENDS_REQUEST_ACK +20a client name: SMSG_FRIENDS_DELETE_PLAYER +20d client name: SMSG_CHAR_BAN_CHAR_LIST +20e client name: SMSG_STARS_KILL +210 client name: SMSG_PVP_INFO +214 client name: SMSG_ADMIN_ACCOUNT_STATS +215 client name: SMSG_PLAYER_SKILL_MESSAGE +216 client name: SMSG_FAMILY_ASK_FOR_CHILD_REPLY +219 client name: SMSG_BLACKSMITH_RANKS_LIST +21a client name: SMSG_ALCHEMIST_RANKS_LIST +21b client name: SMSG_PLAYER_FAME_BLACKSMITH +21c client name: SMSG_PLAYER_FAME_ALCHEMIST +221 client name: SMSG_PLAYER_REFINE_LIST +223 client name: SMSG_PLAYER_UPGRADE_MESSAGE +224 client name: SMSG_PLAYER_FAME_TAEKWON +226 client name: SMSG_TAEKWON_RANKS_LIST +229 client name: SMSG_PLAYER_STATUS_CHANGE +22e client name: SMSG_HOMUNCULUS_INFO +22f client name: SMSG_HOMUNCULUS_FOOD +230 client name: SMSG_HOMUNCULUS_DATA +235 client name: SMSG_HOMUNCULUS_SKILLS +238 client name: SMSG_PK_RANKS_LIST +239 client name: SMSG_HOMUNCULUS_SKILL_UP +23a client name: SMSG_PLAYER_STORAGE_PASSWORD +23c client name: SMSG_PLAYER_STORAGE_PASSWORD_RESULT +240 client name: SMSG_MAIL_MAILS_LIST +242 client name: SMSG_MAIL_READ_MAIL +245 client name: SMSG_MAIL_GET_ATTACHMENT +249 client name: SMSG_MAIL_SEND_MAIL_ACK +24a client name: SMSG_MAIL_NEW_MAIL +250 client name: SMSG_AUCTION_MESSAGE +252 client name: SMSG_AUCTION_RESULTS +253 client name: SMSG_GLADIATOR_FEEL_REQUEST +255 client name: SMSG_MAIL_SET_ATTACHMENT_ACK +256 client name: SMSG_AUCTION_SET_ITEM +257 client name: SMSG_MAIL_DELETE_MAIL_ACK +25a client name: SMSG_PLAYER_COOKING_LIST +25d client name: CMSG_AUCTION_CLOSE +25f client name: SMSG_AUCTION_OPEN_WINDOW +260 client name: SMSG_MAIL_OPEN_WINDOW +274 client name: SMSG_MAIL_RETURN +283 client name: SMSG_MAP_ACCOUNT_ID +284 client name: SMSG_BEING_SPECIAL_EFFECT_NUM +287 client name: SMSG_NPC_CASH_SHOP_OPEN +289 client name: SMSG_NPC_CASH_BUY_ACK +28a client name: SMSG_PLAYER_STATUS_CHANGE2 +28e client name: SMSG_CHAR_CHECK_RENAME +290 client name: SMSG_CHAR_RENAME +291 client name: SMSG_FORMAT_MESSAGE +293 client name: SMSG_BOSS_MAP_INFO +294 client name: SMSG_PLAYER_READ_BOOK +298 client name: SMSG_PLAYER_ITEM_RENTAL_TIME +299 client name: SMSG_PLAYER_ITEM_RENTAL_EXPIRED +29b client name: SMSG_MERCENARY_INFO +29d client name: SMSG_MERCENARY_SKILLS +2a2 client name: SMSG_MERCENARY_UPDATE +2b1 client name: SMSG_QUEST_LIST +2b2 client name: SMSG_QUEST_LIST_OBJECTIVES +2b3 client name: SMSG_QUEST_ADD +2b4 client name: SMSG_QUEST_REMOVE +2b5 client name: SMSG_QUEST_UPDATE_OBJECTIVES +2b7 client name: SMSG_QUEST_ACTIVATE +2b8 client name: SMSG_PARTY_ITEM_PICKUP +2bb client name: SMSG_ITEM_DAMAGED +2c1 client name: SMSG_COLOR_MESSAGE +2c5 client name: SMSG_PARTY_INVITE_RESPONSE +2c6 client name: SMSG_PARTY_INVITED +2c9 client name: SMSG_PARTY_INVITATION_STATS +2cb client name: SMSG_INSTANCE_START +2cc client name: SMSG_INSTANCE_CREATE +2cd client name: SMSG_INSTANCE_INFO +2ce client name: SMSG_INSTANCE_DELETE +2d0 client name: SMSG_PLAYER_EQUIPMENT +2d1 client name: SMSG_PLAYER_STORAGE_EQUIP +2d2 client name: SMSG_PLAYER_CART_EQUIP +2d3 client name: SMSG_BIND_ITEM +2d4 client name: SMSG_PLAYER_INVENTORY_ADD +2d9 client name: SMSG_PLAYER_EQUIP_TICK_ACK +2da client name: SMSG_PLAYER_SHOW_EQUIP +2dc client name: SMSG_BATTLE_CHAT_MESSAGE +2dd client name: SMSG_BATTLE_EMBLEM +2de client name: SMSG_BATTLE_UPDATE_SCORE +2df client name: SMSG_BATTLE_UPDATE_COORDS +2e0 client name: SMSG_BATTLE_UPDATE_HP +2e1 client name: SMSG_BEING_ACTION2 +2e8 client name: SMSG_PLAYER_INVENTORY +2e9 client name: SMSG_PLAYER_CART_ITEMS +2ea client name: SMSG_PLAYER_STORAGE_ITEMS +2eb client name: SMSG_MAP_LOGIN_SUCCESS +2ef client name: SMSG_BEING_FONT +2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR +2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT +43d client name: SMSG_PLAYER_SKILL_COOLDOWN +43f client name: SMSG_BEING_STATUS_CHANGE +440 client name: SMSG_BEING_MILLENIUM_SHIELD +441 client name: SMSG_PLAYER_DELETE_SKILL +442 client name: SMSG_AUTOSHADOW_SPELL_LIST +446 client name: SMSG_QUEST_NPC_EFFECT +7d8 client name: SMSG_PARTY_SETTINGS +7d9 client name: SMSG_PLAYER_SHORTCUTS +7e1 client name: SMSG_PLAYER_UPDATE_SKILL +7e2 client name: SMSG_FORMAT_MESSAGE_NUMBER +7e3 client name: SMSG_SKILL_ITEM_LIST_WINDOW +7e6 client name: SMSG_FORMAT_MESSAGE_SKILL +7e9 client name: SMSG_CHAR_CAPTCHA_NOT_SUPPORTED +7f6 client name: SMSG_PLAYER_GET_EXP +7fa client name: SMSG_PLAYER_INVENTORY_REMOVE2 +7fb client name: SMSG_SKILL_CASTING +7fc client name: SMSG_PARTY_LEADER +7fd client name: SMSG_ITEM_MVP_DROPPED +7fe client name: SMSG_BATTLE_PLAY +800 client name: SMSG_VENDING_ITEMS_LIST +803 client name: SMSG_BOOKING_REGISTER_ACK +805 client name: SMSG_BOOKING_SEARCH_ACK +807 client name: SMSG_BOOKING_DELETE_ACK +809 client name: SMSG_BOOKING_INSERT_NOTIFY +80a client name: SMSG_BOOKING_UPDATE_NOTIFY +80b client name: SMSG_BOOKING_DELETE_NOTIFY +80e client name: SMSG_PLAYER_HP +80f client name: SMSG_TRADE_ITEM_ADD +810 client name: SMSG_BUYINGSTORE_OPEN +812 client name: SMSG_BUYINGSTORE_CREATE_FAILED +813 client name: SMSG_BUYINGSTORE_OWN_ITEMS +814 client name: SMSG_BUYINGSTORE_SHOW_BOARD +816 client name: SMSG_BUYINGSTORE_HIDE_BOARD +818 client name: SMSG_BUYINGSTORE_ITEMS_LIST +81a client name: SMSG_BUYINGSTORE_SELL_FAILED +81b client name: SMSG_BUYINGSTORE_REPORT +81c client name: SMSG_BUYINGSTORE_DELETE_ITEM +81d client name: SMSG_ELEMENTAL_INFO +81e client name: SMSG_ELEMENTAL_UPDATE_STATUS +824 client name: SMSG_BUYINGSTORE_SELLER_SELL_FAILED +828 client name: SMSG_CHAR_DELETE2_ACK +82a client name: SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK +82c client name: SMSG_CHAR_DELETE2_CANCEL_ACK +82d client name: SMSG_CHAR_LOGIN2 +836 client name: SMSG_SEARCHSTORE_SEARCH_ACK +837 client name: SMSG_SEARCHSTORE_SEARCH_FAILED +83a client name: SMSG_SEARCHSTORE_OPEN +83d client name: SMSG_SEARCHSTORE_CLICK_ACK +83e client name: SMSG_LOGIN_ERROR2 +840 client name: SMSG_MAP_NOT_FOUND +845 client name: SMSG_NPC_CASH_POINTS +849 client name: SMSG_NPC_CASH_BUY +859 client name: SMSG_BEING_VIEW_EQUIPMENT +8b3 client name: SMSG_SCRIPT_MESSAGE +8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST +8c7 client name: SMSG_SKILL_ENTRY +8ca client name: SMSG_NPC_CASH_SCHEDULE +8cf client name: SMSG_BEING_CHARM +8d2 client name: SMSG_SKILL_SNAP +8d5 client name: SMSG_CHAR_CHANGE_SLOT +8d6 client name: SMSG_NPC_CLOSE_TIMEOUT +8d8 client name: SMSG_BATTLE_QUEUE_ACK +8d9 client name: SMSG_BATTLE_JOINED +8db client name: SMSG_BATTLE_NOTICE_DELETE +8df client name: SMSG_BATTLE_BEGINS +908 client name: SMSG_PLAYER_FAVORITE_ITEM +90f client name: SMSG_BEING_SPAWN +914 client name: SMSG_BEING_MOVE +915 client name: SMSG_BEING_VISIBLE +96d client name: SMSG_MERGE_ITEM +96f client name: SMSG_ACK_MERGE_ITEMS +977 client name: SMSG_MONSTER_HP +97d client name: SMSG_RANKS_LIST +983 client name: SMSG_BEING_STATUS_CHANGE +985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST +99d client name: SMSG_CHAR_CHARACTERS +9a6 +9a8 +9aa +a02 +a1a +a1c +a20 +a22 +2711 +2713 +2716 +2717 +2718 +2719 +2722 +2723 +2728 +272b +272c +272d +272e +2731 +2734 +2735 +2736 +2737 +2740 +2af9 +2afb +2afd +2b00 +2b03 +2b04 +2b06 +2b09 +2b0d +2b0f +2b12 +2b14 +2b1b +2b1d +2b1e +2b20 +2b21 +2b22 +2b24 +2b25 +2b27 diff --git a/servergreps/hercules/20120700/src/char.c b/servergreps/hercules/20120700/src/char.c new file mode 100644 index 0000000..3b2ae0c --- /dev/null +++ b/servergreps/hercules/20120700/src/char.c @@ -0,0 +1,16369 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + + + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + + + + chr->mmo_char_send_characters(i, sd); + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + + + WFIFOL(fd,10) = (int)delete_date; + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + + + + + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + + + chr->mmo_char_send_characters(fd, sd); + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20120700/src/clif.c b/servergreps/hercules/20120700/src/clif.c new file mode 100644 index 0000000..261613d --- /dev/null +++ b/servergreps/hercules/20120700/src/clif.c @@ -0,0 +1,45847 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; +# 96 "../../../server-code/src/map/clif.c" +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + case AREA: + if( WBUFW(buf,0) == 0x120 && sd->state.warping ) + return 0; + break; + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + p->IsIdentified = i->identify ? 1 : 0; + + + p->location = eqp_pos; + p->WearState = i->equip; + + p->IsDamaged = i->attribute ? 1 : 0; + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + p->IsIdentified = i->identify ? 1 : 0; + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + + + + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } + + + for( i = 0; i < 100; i++ ) { + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2587 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2587 "../../../server-code/src/map/clif.c" + ) + continue; + + if ( sd->status.inventory[i].favorite ) + clif->favorite_item(sd, i); + } + +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } + + + + for( i = 0; i < 100; i++ ) { + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2619 "../../../server-code/src/map/clif.c" + ) + continue; + + if ( sd->status.inventory[i].favorite ) + clif->favorite_item(sd, i); + } + +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + + if (battle_config.show_monster_hp_bar && !(md->status.mode&MD_BOSS)) { + int i; + for (i = 0; i < 30; i++) { + if (md->dmglog[i].id == sd->status.char_id) { + clif->monster_hp_bar(md, sd); + break; + } + } + } + + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + WBUFB(buf, 32) = type; + + + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { + + switch( type ) { + case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; + case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; + case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break; + } +# 14193 "../../../server-code/src/map/clif.c" +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { +# 17680 "../../../server-code/src/map/clif.c" +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +# 18225 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ +# 18268 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ +# 18298 "../../../server-code/src/map/clif.c" +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20120700/src/login.c b/servergreps/hercules/20120700/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20120700/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20120700/uselesspackets.txt b/servergreps/hercules/20120700/uselesspackets.txt new file mode 100644 index 0000000..7aa48f5 --- /dev/null +++ b/servergreps/hercules/20120700/uselesspackets.txt @@ -0,0 +1,42 @@ +Useless packet 0a01. +Useless packet 09a9. +Useless packet 08fc. +Useless packet 0200. +Useless packet 0998. +Useless packet 08d4. +Useless packet 7530. +Useless packet 085b. +Useless packet 09b8. +Useless packet 09b6. +Useless packet 09d8. +Useless packet 09d4. +Useless packet 09d6. +Useless packet 028f. +Useless packet 091a. +Useless packet 0970. +Useless packet 0066. +Useless packet 0187. +Useless packet 08ba. +Useless packet 0064. +Useless packet 0065. +Useless packet 0061. +Useless packet 0068. +Useless packet 0a35. +Useless packet 027c. +Useless packet 0940. +Useless packet 09a7. +Useless packet 0b07. +Useless packet 0b09. +Useless packet 097c. +Useless packet 0b11. +Useless packet 0b13. +Useless packet 0b12. +Useless packet 0b15. +Useless packet 0b14. +Useless packet 095d. +Useless packet 0b0f. +Useless packet 0b0d. +Useless packet 0b0e. +Useless packet 0b0c. +Useless packet 09ab. +Useless packet 0980. diff --git a/servergreps/hercules/20130000/serverpackets.txt b/servergreps/hercules/20130000/serverpackets.txt index 7d9628f..1b2cb2c 100644 --- a/servergreps/hercules/20130000/serverpackets.txt +++ b/servergreps/hercules/20130000/serverpackets.txt @@ -43,7 +43,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -62,7 +61,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -74,11 +72,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -89,10 +83,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -104,7 +95,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -113,7 +103,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -147,7 +136,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -195,8 +183,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -299,7 +285,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -352,7 +337,6 @@ fe client name: SMSG_PARTY_INVITED 845 client name: SMSG_NPC_CASH_POINTS 849 client name: SMSG_NPC_CASH_BUY 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8ca client name: SMSG_NPC_CASH_SCHEDULE 8cf client name: SMSG_BEING_CHARM @@ -363,18 +347,7 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 90f client name: SMSG_BEING_SPAWN 914 client name: SMSG_BEING_MOVE 915 client name: SMSG_BEING_VISIBLE @@ -382,8 +355,6 @@ fe client name: SMSG_PARTY_INVITED 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP 97d client name: SMSG_RANKS_LIST -97e -97f 983 client name: SMSG_BEING_STATUS_CHANGE 985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 990 client name: SMSG_PLAYER_INVENTORY_ADD @@ -402,30 +373,20 @@ fe client name: SMSG_PARTY_INVITED 9a6 9a8 9aa -9d5 -9d7 a02 a1a a1c a20 a22 -a28 -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +396,25 @@ a28 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20130000/src/char.c b/servergreps/hercules/20130000/src/char.c new file mode 100644 index 0000000..7658eff --- /dev/null +++ b/servergreps/hercules/20130000/src/char.c @@ -0,0 +1,16373 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + + + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20130000/src/clif.c b/servergreps/hercules/20130000/src/clif.c new file mode 100644 index 0000000..0c69867 --- /dev/null +++ b/servergreps/hercules/20130000/src/clif.c @@ -0,0 +1,45948 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; +# 96 "../../../server-code/src/map/clif.c" +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + + if (battle_config.show_monster_hp_bar && !(md->status.mode&MD_BOSS)) { + int i; + for (i = 0; i < 30; i++) { + if (md->dmglog[i].id == sd->status.char_id) { + clif->monster_hp_bar(md, sd); + break; + } + } + } + + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + WBUFB(buf, 32) = type; + + + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { + + switch( type ) { + case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; + case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; + case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break; + } +# 14193 "../../../server-code/src/map/clif.c" +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +# 18225 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ +# 18268 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ +# 18298 "../../../server-code/src/map/clif.c" +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20130000/src/login.c b/servergreps/hercules/20130000/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20130000/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20130221/clientpackets.txt b/servergreps/hercules/20130221/clientpackets.txt new file mode 100644 index 0000000..f3aab0c --- /dev/null +++ b/servergreps/hercules/20130221/clientpackets.txt @@ -0,0 +1,31 @@ +UNIMPLIMENTED CMSG_PARTY_CREATE2 +UNIMPLIMENTED CMSG_PARTY_INVITED +00a9 6 clif->pEquipItem +013f 26 clif->pGM_Monster_Item +0217 2 clif->pBlacksmith +0218 2 clif->pAlchemist +021d 6 clif->pLessEffect +0225 2 clif->pTaekwon +0237 2 clif->pRankingPk +0254 3 clif->pFeelSaveOk +0443 8 clif->pSkillSelectMenu +0804 14 clif->pPartyBookingSearchReq +0806 2 clif->pPartyBookingDeleteReq +0808 14 clif->pPartyBookingUpdateReq +0842 6 clif->pGMRecall2 +0843 6 clif->pGMRemove2 +0848 -1 clif->pCashShopBuy +0863 10 clif->pUseSkillToPos +08aa 7 clif->pActionRequest +08e5 41 clif->pPartyRecruitRegisterReq +08e7 10 clif->pPartyRecruitSearchReq +08e9 2 clif->pPartyRecruitDeleteReq +08eb 39 clif->pPartyRecruitUpdateReq +08fb 6 clif->pDull +0916 26 clif->pGuildInvite2 +091d 18 clif->pPartyBookingRegisterReq +0929 26 clif->pPartyInvite2 +0945 -1 clif->pItemListWindowSelected +0963 8 clif->pMoveFromKafra +096e -1 clif->ackmergeitems +0974 2 clif->cancelmergeitem diff --git a/servergreps/hercules/20130221/serverpackets.txt b/servergreps/hercules/20130221/serverpackets.txt new file mode 100644 index 0000000..07cba00 --- /dev/null +++ b/servergreps/hercules/20130221/serverpackets.txt @@ -0,0 +1,420 @@ +j +69 client name: SMSG_LOGIN_DATA +6a client name: SMSG_LOGIN_ERROR +6b client name: SMSG_CHAR_LOGIN +6c client name: SMSG_CHAR_LOGIN_ERROR +6d client name: SMSG_CHAR_CREATE_SUCCEEDED +6e client name: SMSG_CHAR_CREATE_FAILED +6f client name: SMSG_CHAR_DELETE_SUCCEEDED +70 client name: SMSG_CHAR_DELETE_FAILED +71 client name: SMSG_CHAR_MAP_INFO +74 client name: SMSG_MAP_AUTH_REFUSE +78 client name: SMSG_BEING_FAKE_NAME +7f client name: SMSG_SERVER_PING +80 client name: SMSG_BEING_REMOVE +81 client name: SMSG_CONNECTION_PROBLEM +86 client name: SMSG_BEING_MOVE2 +87 client name: SMSG_WALK_RESPONSE +88 client name: SMSG_PLAYER_STOP +8a client name: SMSG_BEING_ACTION +8d client name: SMSG_BEING_CHAT +8e client name: SMSG_PLAYER_CHAT +91 client name: SMSG_PLAYER_WARP +92 client name: SMSG_CHANGE_MAP_SERVER +95 client name: SMSG_BEING_NAME_RESPONSE +97 client name: SMSG_WHISPER +98 client name: SMSG_WHISPER_RESPONSE +9a client name: SMSG_GM_CHAT +9c client name: SMSG_BEING_CHANGE_DIRECTION +9d client name: SMSG_ITEM_VISIBLE +a1 client name: SMSG_ITEM_REMOVE +a8 client name: SMSG_ITEM_USE_RESPONSE +af client name: SMSG_PLAYER_INVENTORY_REMOVE +b0 client name: SMSG_PLAYER_STAT_UPDATE_1 +b1 client name: SMSG_PLAYER_STAT_UPDATE_2 +b3 client name: SMSG_CHAR_SWITCH_RESPONSE +b4 client name: SMSG_NPC_MESSAGE +b5 client name: SMSG_NPC_NEXT +b6 client name: SMSG_NPC_CLOSE +b7 client name: SMSG_NPC_CHOICE +bc client name: SMSG_PLAYER_STAT_UPDATE_4 +bd client name: SMSG_PLAYER_STAT_UPDATE_5 +be client name: SMSG_PLAYER_STAT_UPDATE_6 +c0 client name: SMSG_BEING_EMOTION +c2 client name: SMSG_WHO_ANSWER +c4 client name: SMSG_NPC_BUY_SELL_CHOICE +c6 client name: SMSG_NPC_BUY +c7 client name: SMSG_NPC_SELL +ca client name: SMSG_NPC_BUY_RESPONSE +cb client name: SMSG_NPC_SELL_RESPONSE +cd client name: SMSG_ADMIN_KICK_ACK +d1 client name: SMSG_IGNORE_NICK_ACK +d2 client name: SMSG_IGNORE_ALL_RESPONSE +d4 client name: SMSG_CHAT_IGNORE_LIST +d6 client name: SMSG_CHAT_ROOM_CREATE_ACK +d7 client name: SMSG_CHAT_DISPLAY +d8 client name: SMSG_CHAT_ROOM_DESTROY +da client name: SMSG_CHAT_ROOM_JOIN_FAILED +db client name: SMSG_CHAT_ROOM_JOIN_ACK +dc client name: SMSG_CHAT_ROOM_ADD_MEMBER +dd client name: SMSG_CHAT_ROOM_LEAVE +df client name: SMSG_CHAT_ROOM_SETTINGS +e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE +e7 client name: SMSG_TRADE_RESPONSE_OUTDATED +ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE +ec client name: SMSG_TRADE_OK +ee client name: SMSG_TRADE_CANCEL +f0 client name: SMSG_TRADE_COMPLETE +f1 client name: SMSG_TRADE_UNDO +f2 client name: SMSG_PLAYER_STORAGE_STATUS +f6 client name: SMSG_PLAYER_STORAGE_REMOVE +f8 client name: SMSG_PLAYER_STORAGE_CLOSE +fa client name: SMSG_PARTY_CREATE +fb client name: SMSG_PARTY_INFO +105 client name: SMSG_PARTY_LEAVE +107 client name: SMSG_PARTY_UPDATE_COORDS +109 client name: SMSG_PARTY_MESSAGE +10a client name: SMSG_MVP_ITEM +10b client name: SMSG_MVP_EXP +10c client name: SMSG_MVP_EFFECT +10d client name: SMSG_MVP_NO_ITEM +10e client name: SMSG_PLAYER_SKILL_UP +10f client name: SMSG_PLAYER_SKILLS +110 client name: SMSG_SKILL_FAILED +111 client name: SMSG_PLAYER_ADD_SKILL +117 client name: SMSG_SKILL_GROUND_NO_DAMAGE +11a client name: SMSG_SKILL_NO_DAMAGE +11c client name: SMSG_SKILL_WARP_POINT +11e client name: SMSG_SKILL_MEMO_MESSAGE +120 client name: SMSG_BEING_REMOVE_SKILL +121 client name: SMSG_CART_INFO +125 client name: SMSG_PLAYER_CART_REMOVE +12b client name: SMSG_CART_REMOVE +12c client name: SMSG_PLAYER_CART_ADD_ERROR +12d client name: SMSG_VENDING_OPEN_REQ +131 client name: SMSG_VENDING_SHOW_BOARD +132 client name: SMSG_VENDING_HIDE_BOARD +135 client name: SMSG_VENDING_BUY_ACK +136 client name: SMSG_VENDING_OPEN +137 client name: SMSG_VENDING_REPORT +139 client name: SMSG_PLAYER_MOVE_TO_ATTACK +13a client name: SMSG_PLAYER_ATTACK_RANGE +13b client name: SMSG_PLAYER_ARROW_MESSAGE +13c client name: SMSG_PLAYER_ARROW_EQUIP +13d client name: SMSG_PLAYER_HEAL +141 client name: SMSG_PLAYER_STAT_UPDATE_3 +142 client name: SMSG_NPC_INT_INPUT +144 client name: SMSG_NPC_VIEWPOINT +147 client name: SMSG_SKILL_AUTO_CAST +148 client name: SMSG_BEING_RESURRECT +14a client name: SMSG_MANNER_MESSAGE +14b client name: SMSG_CHAT_SILENCE +14c client name: SMSG_GUILD_ALIANCE_INFO +14e client name: SMSG_GUILD_MASTER_OR_MEMBER +152 client name: SMSG_GUILD_EMBLEM_DATA +154 client name: SMSG_GUILD_MEMBER_LIST +156 client name: SMSG_GUILD_MEMBER_POS_CHANGE +15a client name: SMSG_GUILD_LEAVE +15e client name: SMSG_GUILD_BROKEN +160 client name: SMSG_GUILD_POS_INFO_LIST +162 client name: SMSG_GUILD_SKILL_INFO +163 client name: SMSG_GUILD_EXPULSION_LIST +166 client name: SMSG_GUILD_POS_NAME_LIST +167 client name: SMSG_GUILD_CREATE_RESPONSE +169 client name: SMSG_GUILD_INVITE_ACK +16a client name: SMSG_GUILD_INVITE +16c client name: SMSG_GUILD_POSITION_INFO +16f client name: SMSG_GUILD_NOTICE +171 client name: SMSG_GUILD_REQ_ALLIANCE +173 client name: SMSG_GUILD_REQ_ALLIANCE_ACK +174 client name: SMSG_GUILD_POSITION_CHANGED +177 client name: SMSG_PLAYER_IDENTIFY_LIST +179 client name: SMSG_PLAYER_IDENTIFIED +17b client name: SMSG_PLAYER_USE_CARD +17d client name: SMSG_PLAYER_INSERT_CARD +17f client name: SMSG_GUILD_MESSAGE +181 client name: SMSG_GUILD_OPPOSITION_ACK +184 client name: SMSG_GUILD_DEL_ALLIANCE +188 client name: SMSG_PLAYER_REFINE +189 client name: SMSG_PLAYER_NOTIFY_MAPINFO +18b client name: SMSG_MAP_QUIT_RESPONSE +18c client name: SMSG_MONSTER_INFO +18d client name: SMSG_PLAYER_SKILL_PRODUCE_MIX_LIST +18f client name: SMSG_PLAYER_SKILL_PRODUCE_EFFECT +191 client name: SMSG_CHAT_TALKIE_BOX +192 client name: SMSG_ADMIN_SET_TILE_TYPE +194 client name: SMSG_SOLVE_CHAR_NAME +196 client name: SMSG_BEING_STATUS_CHANGE +199 client name: SMSG_PVP_MAP_MODE +19a client name: SMSG_PVP_SET +19b client name: SMSG_BEING_SELFEFFECT +19e client name: SMSG_PET_CATCH_PROCESS +1a0 client name: SMSG_PET_ROULETTE +1a2 client name: SMSG_PET_STATUS +1a3 client name: SMSG_PET_FOOD +1a4 client name: SMSG_PET_DATA +1a6 client name: SMSG_PET_EGGS_LIST +1aa client name: SMSG_PET_MESSAGE +1ab client name: SMSG_BEING_STAT_UPDATE_1 +1ac client name: SMSG_SKILL_UNIT_UPDATE +1ad client name: SMSG_SKILL_ARROW_CREATE_LIST +1b0 client name: SMSG_CLASS_CHANGE +1b1 client name: SMSG_NPC_SHOW_DIGIT +1b3 client name: SMSG_NPC_CUTIN +1b4 client name: SMSG_GUILD_EMBLEM +1b6 client name: SMSG_GUILD_BASIC_INFO +1b9 client name: SMSG_SKILL_CAST_CANCEL +1c3 client name: SMSG_GM_CHAT2 +1c4 client name: SMSG_PLAYER_STORAGE_ADD +1c5 client name: SMSG_PLAYER_CART_ADD +1c8 client name: SMSG_PLAYER_INVENTORY_USE +1c9 client name: SMSG_GRAFFITI_VISIBLE +1cd client name: SMSG_PLAYER_SKILL_AUTO_SPELLS +1cf client name: SMSG_SKILL_DEVOTION_EFFECT +1d0 client name: SMSG_SPIRIT_BALLS +1d1 client name: SMSG_BLADE_STOP +1d2 client name: SMSG_COMBO_DELAY +1d3 client name: SMSG_BEING_SOUND_EFFECT +1d4 client name: SMSG_NPC_STR_INPUT +1d6 client name: SMSG_MAP_TYPE +1d7 client name: SMSG_BEING_CHANGE_LOOKS2 +1dc client name: SMSG_LOGIN_CODING_KEY +1de client name: SMSG_SKILL_DAMAGE +1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK +1e1 client name: SMSG_SPIRIT_BALL_SINGLE +1e6 client name: SMSG_FAMILY_CALL_PARTNER +1e9 client name: SMSG_PARTY_MEMBER_INFO +1ea client name: SMSG_WEDDING_EFFECT +1eb client name: SMSG_GUILD_UPDATE_COORDS +1f2 client name: SMSG_GUILD_MEMBER_LOGIN +1f3 client name: SMSG_BEING_SPECIAL_EFFECT +1f4 client name: SMSG_TRADE_REQUEST +1f5 client name: SMSG_TRADE_RESPONSE +1f6 client name: SMSG_FAMILY_ASK_FOR_CHILD +1fc client name: SMSG_PLAYER_REPAIR_LIST +1fe client name: SMSG_PLAYER_REPAIR_EFFECT +1ff client name: SMSG_BEING_SLIDE +201 client name: SMSG_FRIENDS_LIST +205 client name: SMSG_FAMILY_DIVORCED +206 client name: SMSG_FRIENDS_PLAYER_ONLINE +207 client name: SMSG_FRIENDS_REQUEST +209 client name: SMSG_FRIENDS_REQUEST_ACK +20a client name: SMSG_FRIENDS_DELETE_PLAYER +20d client name: SMSG_CHAR_BAN_CHAR_LIST +20e client name: SMSG_STARS_KILL +210 client name: SMSG_PVP_INFO +214 client name: SMSG_ADMIN_ACCOUNT_STATS +215 client name: SMSG_PLAYER_SKILL_MESSAGE +216 client name: SMSG_FAMILY_ASK_FOR_CHILD_REPLY +219 client name: SMSG_BLACKSMITH_RANKS_LIST +21a client name: SMSG_ALCHEMIST_RANKS_LIST +21b client name: SMSG_PLAYER_FAME_BLACKSMITH +21c client name: SMSG_PLAYER_FAME_ALCHEMIST +221 client name: SMSG_PLAYER_REFINE_LIST +223 client name: SMSG_PLAYER_UPGRADE_MESSAGE +224 client name: SMSG_PLAYER_FAME_TAEKWON +226 client name: SMSG_TAEKWON_RANKS_LIST +229 client name: SMSG_PLAYER_STATUS_CHANGE +22e client name: SMSG_HOMUNCULUS_INFO +22f client name: SMSG_HOMUNCULUS_FOOD +230 client name: SMSG_HOMUNCULUS_DATA +235 client name: SMSG_HOMUNCULUS_SKILLS +238 client name: SMSG_PK_RANKS_LIST +239 client name: SMSG_HOMUNCULUS_SKILL_UP +23a client name: SMSG_PLAYER_STORAGE_PASSWORD +23c client name: SMSG_PLAYER_STORAGE_PASSWORD_RESULT +240 client name: SMSG_MAIL_MAILS_LIST +242 client name: SMSG_MAIL_READ_MAIL +245 client name: SMSG_MAIL_GET_ATTACHMENT +249 client name: SMSG_MAIL_SEND_MAIL_ACK +24a client name: SMSG_MAIL_NEW_MAIL +250 client name: SMSG_AUCTION_MESSAGE +252 client name: SMSG_AUCTION_RESULTS +253 client name: SMSG_GLADIATOR_FEEL_REQUEST +255 client name: SMSG_MAIL_SET_ATTACHMENT_ACK +256 client name: SMSG_AUCTION_SET_ITEM +257 client name: SMSG_MAIL_DELETE_MAIL_ACK +25a client name: SMSG_PLAYER_COOKING_LIST +25d client name: CMSG_AUCTION_CLOSE +25f client name: SMSG_AUCTION_OPEN_WINDOW +260 client name: SMSG_MAIL_OPEN_WINDOW +274 client name: SMSG_MAIL_RETURN +283 client name: SMSG_MAP_ACCOUNT_ID +284 client name: SMSG_BEING_SPECIAL_EFFECT_NUM +287 client name: SMSG_NPC_CASH_SHOP_OPEN +289 client name: SMSG_NPC_CASH_BUY_ACK +28a client name: SMSG_PLAYER_STATUS_CHANGE2 +28e client name: SMSG_CHAR_CHECK_RENAME +290 client name: SMSG_CHAR_RENAME +291 client name: SMSG_FORMAT_MESSAGE +293 client name: SMSG_BOSS_MAP_INFO +294 client name: SMSG_PLAYER_READ_BOOK +298 client name: SMSG_PLAYER_ITEM_RENTAL_TIME +299 client name: SMSG_PLAYER_ITEM_RENTAL_EXPIRED +29b client name: SMSG_MERCENARY_INFO +29d client name: SMSG_MERCENARY_SKILLS +2a2 client name: SMSG_MERCENARY_UPDATE +2b1 client name: SMSG_QUEST_LIST +2b2 client name: SMSG_QUEST_LIST_OBJECTIVES +2b3 client name: SMSG_QUEST_ADD +2b4 client name: SMSG_QUEST_REMOVE +2b5 client name: SMSG_QUEST_UPDATE_OBJECTIVES +2b7 client name: SMSG_QUEST_ACTIVATE +2b8 client name: SMSG_PARTY_ITEM_PICKUP +2bb client name: SMSG_ITEM_DAMAGED +2c1 client name: SMSG_COLOR_MESSAGE +2c5 client name: SMSG_PARTY_INVITE_RESPONSE +2c6 client name: SMSG_PARTY_INVITED +2c9 client name: SMSG_PARTY_INVITATION_STATS +2cb client name: SMSG_INSTANCE_START +2cc client name: SMSG_INSTANCE_CREATE +2cd client name: SMSG_INSTANCE_INFO +2ce client name: SMSG_INSTANCE_DELETE +2d3 client name: SMSG_BIND_ITEM +2d9 client name: SMSG_PLAYER_EQUIP_TICK_ACK +2da client name: SMSG_PLAYER_SHOW_EQUIP +2dc client name: SMSG_BATTLE_CHAT_MESSAGE +2dd client name: SMSG_BATTLE_EMBLEM +2de client name: SMSG_BATTLE_UPDATE_SCORE +2df client name: SMSG_BATTLE_UPDATE_COORDS +2e0 client name: SMSG_BATTLE_UPDATE_HP +2e1 client name: SMSG_BEING_ACTION2 +2eb client name: SMSG_MAP_LOGIN_SUCCESS +2ef client name: SMSG_BEING_FONT +2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR +2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT +43d client name: SMSG_PLAYER_SKILL_COOLDOWN +43f client name: SMSG_BEING_STATUS_CHANGE +440 client name: SMSG_BEING_MILLENIUM_SHIELD +441 client name: SMSG_PLAYER_DELETE_SKILL +442 client name: SMSG_AUTOSHADOW_SPELL_LIST +446 client name: SMSG_QUEST_NPC_EFFECT +7d8 client name: SMSG_PARTY_SETTINGS +7d9 client name: SMSG_PLAYER_SHORTCUTS +7e1 client name: SMSG_PLAYER_UPDATE_SKILL +7e2 client name: SMSG_FORMAT_MESSAGE_NUMBER +7e3 client name: SMSG_SKILL_ITEM_LIST_WINDOW +7e6 client name: SMSG_FORMAT_MESSAGE_SKILL +7e9 client name: SMSG_CHAR_CAPTCHA_NOT_SUPPORTED +7f6 client name: SMSG_PLAYER_GET_EXP +7fa client name: SMSG_PLAYER_INVENTORY_REMOVE2 +7fb client name: SMSG_SKILL_CASTING +7fc client name: SMSG_PARTY_LEADER +7fd client name: SMSG_ITEM_MVP_DROPPED +7fe client name: SMSG_BATTLE_PLAY +800 client name: SMSG_VENDING_ITEMS_LIST +803 client name: SMSG_BOOKING_REGISTER_ACK +805 client name: SMSG_BOOKING_SEARCH_ACK +807 client name: SMSG_BOOKING_DELETE_ACK +809 client name: SMSG_BOOKING_INSERT_NOTIFY +80a client name: SMSG_BOOKING_UPDATE_NOTIFY +80b client name: SMSG_BOOKING_DELETE_NOTIFY +80e client name: SMSG_PLAYER_HP +80f client name: SMSG_TRADE_ITEM_ADD +810 client name: SMSG_BUYINGSTORE_OPEN +812 client name: SMSG_BUYINGSTORE_CREATE_FAILED +813 client name: SMSG_BUYINGSTORE_OWN_ITEMS +814 client name: SMSG_BUYINGSTORE_SHOW_BOARD +816 client name: SMSG_BUYINGSTORE_HIDE_BOARD +818 client name: SMSG_BUYINGSTORE_ITEMS_LIST +81a client name: SMSG_BUYINGSTORE_SELL_FAILED +81b client name: SMSG_BUYINGSTORE_REPORT +81c client name: SMSG_BUYINGSTORE_DELETE_ITEM +81d client name: SMSG_ELEMENTAL_INFO +81e client name: SMSG_ELEMENTAL_UPDATE_STATUS +824 client name: SMSG_BUYINGSTORE_SELLER_SELL_FAILED +828 client name: SMSG_CHAR_DELETE2_ACK +82a client name: SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK +82c client name: SMSG_CHAR_DELETE2_CANCEL_ACK +82d client name: SMSG_CHAR_LOGIN2 +836 client name: SMSG_SEARCHSTORE_SEARCH_ACK +837 client name: SMSG_SEARCHSTORE_SEARCH_FAILED +83a client name: SMSG_SEARCHSTORE_OPEN +83d client name: SMSG_SEARCHSTORE_CLICK_ACK +83e client name: SMSG_LOGIN_ERROR2 +840 client name: SMSG_MAP_NOT_FOUND +845 client name: SMSG_NPC_CASH_POINTS +849 client name: SMSG_NPC_CASH_BUY +84b client name: SMSG_ITEM_DROPPED +8b3 client name: SMSG_SCRIPT_MESSAGE +8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST +8ca client name: SMSG_NPC_CASH_SCHEDULE +8cf client name: SMSG_BEING_CHARM +8d2 client name: SMSG_SKILL_SNAP +8d5 client name: SMSG_CHAR_CHANGE_SLOT +8d6 client name: SMSG_NPC_CLOSE_TIMEOUT +8d8 client name: SMSG_BATTLE_QUEUE_ACK +8d9 client name: SMSG_BATTLE_JOINED +8db client name: SMSG_BATTLE_NOTICE_DELETE +8df client name: SMSG_BATTLE_BEGINS +908 client name: SMSG_PLAYER_FAVORITE_ITEM +90f client name: SMSG_BEING_SPAWN +914 client name: SMSG_BEING_MOVE +915 client name: SMSG_BEING_VISIBLE +96d client name: SMSG_MERGE_ITEM +96f client name: SMSG_ACK_MERGE_ITEMS +977 client name: SMSG_MONSTER_HP +97d client name: SMSG_RANKS_LIST +983 client name: SMSG_BEING_STATUS_CHANGE +985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST +990 client name: SMSG_PLAYER_INVENTORY_ADD +991 client name: SMSG_PLAYER_INVENTORY +992 client name: SMSG_PLAYER_EQUIPMENT +993 client name: SMSG_PLAYER_CART_ITEMS +994 client name: SMSG_PLAYER_CART_EQUIP +995 client name: SMSG_PLAYER_STORAGE_ITEMS +996 client name: SMSG_PLAYER_STORAGE_EQUIP +997 client name: SMSG_BEING_VIEW_EQUIPMENT +999 client name: SMSG_PLAYER_EQUIP +99a client name: SMSG_PLAYER_UNEQUIP +99b client name: SMSG_MAP_TYPE_PROPERTY2 +99d client name: SMSG_CHAR_CHARACTERS +99f client name: SMSG_SKILL_ENTRY +9a6 +9a8 +9aa +a02 +a1a +a1c +a20 +a22 +2711 +2713 +2716 +2717 +2718 +2719 +2722 +2723 +2728 +272b +272c +272d +272e +2731 +2734 +2735 +2736 +2737 +2740 +2af9 +2afb +2afd +2b00 +2b03 +2b04 +2b06 +2b09 +2b0d +2b0f +2b12 +2b14 +2b1b +2b1d +2b1e +2b20 +2b21 +2b22 +2b24 +2b25 +2b27 diff --git a/servergreps/hercules/20130221/src/char.c b/servergreps/hercules/20130221/src/char.c new file mode 100644 index 0000000..7658eff --- /dev/null +++ b/servergreps/hercules/20130221/src/char.c @@ -0,0 +1,16373 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + + + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20130221/src/clif.c b/servergreps/hercules/20130221/src/clif.c new file mode 100644 index 0000000..404afe9 --- /dev/null +++ b/servergreps/hercules/20130221/src/clif.c @@ -0,0 +1,45948 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; +# 96 "../../../server-code/src/map/clif.c" +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + + + + p.GID = bl->id; + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + + if (battle_config.show_monster_hp_bar && !(md->status.mode&MD_BOSS)) { + int i; + for (i = 0; i < 30; i++) { + if (md->dmglog[i].id == sd->status.char_id) { + clif->monster_hp_bar(md, sd); + break; + } + } + } + + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + WBUFB(buf, 32) = type; + + + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { + + switch( type ) { + case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; + case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; + case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break; + } +# 14193 "../../../server-code/src/map/clif.c" +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +# 18225 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ +# 18268 "../../../server-code/src/map/clif.c" +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ +# 18298 "../../../server-code/src/map/clif.c" +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20130221/src/login.c b/servergreps/hercules/20130221/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20130221/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20130221/uselesspackets.txt b/servergreps/hercules/20130221/uselesspackets.txt new file mode 100644 index 0000000..f848299 --- /dev/null +++ b/servergreps/hercules/20130221/uselesspackets.txt @@ -0,0 +1,41 @@ +Useless packet 0a01. +Useless packet 09a9. +Useless packet 08fc. +Useless packet 0200. +Useless packet 0998. +Useless packet 08d4. +Useless packet 7530. +Useless packet 085b. +Useless packet 09b8. +Useless packet 09b6. +Useless packet 09d8. +Useless packet 09d4. +Useless packet 09d6. +Useless packet 028f. +Useless packet 091a. +Useless packet 0970. +Useless packet 0066. +Useless packet 0187. +Useless packet 08ba. +Useless packet 0064. +Useless packet 0065. +Useless packet 0061. +Useless packet 0068. +Useless packet 0a35. +Useless packet 027c. +Useless packet 09a7. +Useless packet 0b07. +Useless packet 0b09. +Useless packet 097c. +Useless packet 0b11. +Useless packet 0b13. +Useless packet 0b12. +Useless packet 0b15. +Useless packet 0b14. +Useless packet 095d. +Useless packet 0b0f. +Useless packet 0b0d. +Useless packet 0b0e. +Useless packet 0b0c. +Useless packet 09ab. +Useless packet 0980. diff --git a/servergreps/hercules/20140000/serverpackets.txt b/servergreps/hercules/20140000/serverpackets.txt index 81b3fb1..25714d7 100644 --- a/servergreps/hercules/20140000/serverpackets.txt +++ b/servergreps/hercules/20140000/serverpackets.txt @@ -41,7 +41,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -60,7 +59,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -72,11 +70,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -87,10 +81,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -102,7 +93,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -111,7 +101,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -145,7 +134,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -193,8 +181,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -296,7 +282,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -350,7 +335,6 @@ fe client name: SMSG_PARTY_INVITED 849 client name: SMSG_NPC_CASH_BUY 84b client name: SMSG_ITEM_DROPPED 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8c8 client name: SMSG_BEING_ACTION2 8ca client name: SMSG_NPC_CASH_SCHEDULE @@ -362,24 +346,12 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP 97d client name: SMSG_RANKS_LIST 97e client name: SMSG_PLAYER_RANK_POINTS -97f 983 client name: SMSG_BEING_STATUS_CHANGE 985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 990 client name: SMSG_PLAYER_INVENTORY_ADD @@ -409,23 +381,15 @@ a1a a1c a20 a22 -a28 -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +399,25 @@ a28 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20140000/src/char.c b/servergreps/hercules/20140000/src/char.c new file mode 100644 index 0000000..7658eff --- /dev/null +++ b/servergreps/hercules/20140000/src/char.c @@ -0,0 +1,16373 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + + + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20140000/src/clif.c b/servergreps/hercules/20140000/src/clif.c new file mode 100644 index 0000000..59eb765 --- /dev/null +++ b/servergreps/hercules/20140000/src/clif.c @@ -0,0 +1,46647 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20140000/src/login.c b/servergreps/hercules/20140000/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20140000/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20140403/clientpackets.txt b/servergreps/hercules/20140403/clientpackets.txt new file mode 100644 index 0000000..6a4e3b3 --- /dev/null +++ b/servergreps/hercules/20140403/clientpackets.txt @@ -0,0 +1,30 @@ +UNIMPLIMENTED CMSG_PARTY_CREATE2 +UNIMPLIMENTED CMSG_PARTY_INVITED +0217 2 clif->pBlacksmith +0218 2 clif->pAlchemist +021d 6 clif->pLessEffect +0225 2 clif->pTaekwon +0237 2 clif->pRankingPk +0254 3 clif->pFeelSaveOk +0443 8 clif->pSkillSelectMenu +0804 14 clif->pPartyBookingSearchReq +0806 2 clif->pPartyBookingDeleteReq +0808 14 clif->pPartyBookingUpdateReq +0842 6 clif->pGMRecall2 +0843 6 clif->pGMRemove2 +0848 -1 clif->pCashShopBuy +08e5 41 clif->pPartyRecruitRegisterReq +08e7 10 clif->pPartyRecruitSearchReq +08e9 2 clif->pPartyRecruitDeleteReq +08eb 39 clif->pPartyRecruitUpdateReq +08fb 6 clif->pDull +0916 26 clif->pGuildInvite2 +0959 18 clif->pPartyBookingRegisterReq +0960 5 clif->pHomMenu +0963 -1 clif->pItemListWindowSelected +0964 36 clif->pStoragePassword +0968 8 clif->pMoveToKafra +0969 6 clif->pReqClickBuyingStore +096e -1 clif->ackmergeitems +0974 2 clif->cancelmergeitem +09ce 102 clif->pGM_Monster_Item diff --git a/servergreps/hercules/20140403/serverpackets.txt b/servergreps/hercules/20140403/serverpackets.txt new file mode 100644 index 0000000..25714d7 --- /dev/null +++ b/servergreps/hercules/20140403/serverpackets.txt @@ -0,0 +1,423 @@ +j +69 client name: SMSG_LOGIN_DATA +6a client name: SMSG_LOGIN_ERROR +6b client name: SMSG_CHAR_LOGIN +6c client name: SMSG_CHAR_LOGIN_ERROR +6d client name: SMSG_CHAR_CREATE_SUCCEEDED +6e client name: SMSG_CHAR_CREATE_FAILED +6f client name: SMSG_CHAR_DELETE_SUCCEEDED +70 client name: SMSG_CHAR_DELETE_FAILED +71 client name: SMSG_CHAR_MAP_INFO +74 client name: SMSG_MAP_AUTH_REFUSE +78 client name: SMSG_BEING_FAKE_NAME +7f client name: SMSG_SERVER_PING +80 client name: SMSG_BEING_REMOVE +81 client name: SMSG_CONNECTION_PROBLEM +86 client name: SMSG_BEING_MOVE2 +87 client name: SMSG_WALK_RESPONSE +88 client name: SMSG_PLAYER_STOP +8a client name: SMSG_BEING_ACTION +8d client name: SMSG_BEING_CHAT +8e client name: SMSG_PLAYER_CHAT +91 client name: SMSG_PLAYER_WARP +92 client name: SMSG_CHANGE_MAP_SERVER +95 client name: SMSG_BEING_NAME_RESPONSE +97 client name: SMSG_WHISPER +9a client name: SMSG_GM_CHAT +9c client name: SMSG_BEING_CHANGE_DIRECTION +9d client name: SMSG_ITEM_VISIBLE +a1 client name: SMSG_ITEM_REMOVE +a8 client name: SMSG_ITEM_USE_RESPONSE +af client name: SMSG_PLAYER_INVENTORY_REMOVE +b0 client name: SMSG_PLAYER_STAT_UPDATE_1 +b1 client name: SMSG_PLAYER_STAT_UPDATE_2 +b3 client name: SMSG_CHAR_SWITCH_RESPONSE +b4 client name: SMSG_NPC_MESSAGE +b5 client name: SMSG_NPC_NEXT +b6 client name: SMSG_NPC_CLOSE +b7 client name: SMSG_NPC_CHOICE +bc client name: SMSG_PLAYER_STAT_UPDATE_4 +bd client name: SMSG_PLAYER_STAT_UPDATE_5 +be client name: SMSG_PLAYER_STAT_UPDATE_6 +c0 client name: SMSG_BEING_EMOTION +c2 client name: SMSG_WHO_ANSWER +c4 client name: SMSG_NPC_BUY_SELL_CHOICE +c6 client name: SMSG_NPC_BUY +c7 client name: SMSG_NPC_SELL +ca client name: SMSG_NPC_BUY_RESPONSE +cb client name: SMSG_NPC_SELL_RESPONSE +cd client name: SMSG_ADMIN_KICK_ACK +d1 client name: SMSG_IGNORE_NICK_ACK +d2 client name: SMSG_IGNORE_ALL_RESPONSE +d4 client name: SMSG_CHAT_IGNORE_LIST +d6 client name: SMSG_CHAT_ROOM_CREATE_ACK +d7 client name: SMSG_CHAT_DISPLAY +d8 client name: SMSG_CHAT_ROOM_DESTROY +da client name: SMSG_CHAT_ROOM_JOIN_FAILED +db client name: SMSG_CHAT_ROOM_JOIN_ACK +dc client name: SMSG_CHAT_ROOM_ADD_MEMBER +dd client name: SMSG_CHAT_ROOM_LEAVE +df client name: SMSG_CHAT_ROOM_SETTINGS +e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE +e7 client name: SMSG_TRADE_RESPONSE_OUTDATED +ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE +ec client name: SMSG_TRADE_OK +ee client name: SMSG_TRADE_CANCEL +f0 client name: SMSG_TRADE_COMPLETE +f1 client name: SMSG_TRADE_UNDO +f2 client name: SMSG_PLAYER_STORAGE_STATUS +f6 client name: SMSG_PLAYER_STORAGE_REMOVE +f8 client name: SMSG_PLAYER_STORAGE_CLOSE +fa client name: SMSG_PARTY_CREATE +fb client name: SMSG_PARTY_INFO +105 client name: SMSG_PARTY_LEAVE +107 client name: SMSG_PARTY_UPDATE_COORDS +109 client name: SMSG_PARTY_MESSAGE +10a client name: SMSG_MVP_ITEM +10b client name: SMSG_MVP_EXP +10c client name: SMSG_MVP_EFFECT +10d client name: SMSG_MVP_NO_ITEM +10e client name: SMSG_PLAYER_SKILL_UP +10f client name: SMSG_PLAYER_SKILLS +110 client name: SMSG_SKILL_FAILED +111 client name: SMSG_PLAYER_ADD_SKILL +117 client name: SMSG_SKILL_GROUND_NO_DAMAGE +11a client name: SMSG_SKILL_NO_DAMAGE +11c client name: SMSG_SKILL_WARP_POINT +11e client name: SMSG_SKILL_MEMO_MESSAGE +120 client name: SMSG_BEING_REMOVE_SKILL +121 client name: SMSG_CART_INFO +125 client name: SMSG_PLAYER_CART_REMOVE +12b client name: SMSG_CART_REMOVE +12c client name: SMSG_PLAYER_CART_ADD_ERROR +12d client name: SMSG_VENDING_OPEN_REQ +131 client name: SMSG_VENDING_SHOW_BOARD +132 client name: SMSG_VENDING_HIDE_BOARD +135 client name: SMSG_VENDING_BUY_ACK +136 client name: SMSG_VENDING_OPEN +137 client name: SMSG_VENDING_REPORT +139 client name: SMSG_PLAYER_MOVE_TO_ATTACK +13a client name: SMSG_PLAYER_ATTACK_RANGE +13b client name: SMSG_PLAYER_ARROW_MESSAGE +13c client name: SMSG_PLAYER_ARROW_EQUIP +13d client name: SMSG_PLAYER_HEAL +141 client name: SMSG_PLAYER_STAT_UPDATE_3 +142 client name: SMSG_NPC_INT_INPUT +144 client name: SMSG_NPC_VIEWPOINT +147 client name: SMSG_SKILL_AUTO_CAST +148 client name: SMSG_BEING_RESURRECT +14a client name: SMSG_MANNER_MESSAGE +14b client name: SMSG_CHAT_SILENCE +14c client name: SMSG_GUILD_ALIANCE_INFO +14e client name: SMSG_GUILD_MASTER_OR_MEMBER +152 client name: SMSG_GUILD_EMBLEM_DATA +154 client name: SMSG_GUILD_MEMBER_LIST +156 client name: SMSG_GUILD_MEMBER_POS_CHANGE +15a client name: SMSG_GUILD_LEAVE +15e client name: SMSG_GUILD_BROKEN +160 client name: SMSG_GUILD_POS_INFO_LIST +162 client name: SMSG_GUILD_SKILL_INFO +163 client name: SMSG_GUILD_EXPULSION_LIST +166 client name: SMSG_GUILD_POS_NAME_LIST +167 client name: SMSG_GUILD_CREATE_RESPONSE +169 client name: SMSG_GUILD_INVITE_ACK +16a client name: SMSG_GUILD_INVITE +16c client name: SMSG_GUILD_POSITION_INFO +16f client name: SMSG_GUILD_NOTICE +171 client name: SMSG_GUILD_REQ_ALLIANCE +173 client name: SMSG_GUILD_REQ_ALLIANCE_ACK +174 client name: SMSG_GUILD_POSITION_CHANGED +177 client name: SMSG_PLAYER_IDENTIFY_LIST +179 client name: SMSG_PLAYER_IDENTIFIED +17b client name: SMSG_PLAYER_USE_CARD +17d client name: SMSG_PLAYER_INSERT_CARD +17f client name: SMSG_GUILD_MESSAGE +181 client name: SMSG_GUILD_OPPOSITION_ACK +184 client name: SMSG_GUILD_DEL_ALLIANCE +188 client name: SMSG_PLAYER_REFINE +189 client name: SMSG_PLAYER_NOTIFY_MAPINFO +18b client name: SMSG_MAP_QUIT_RESPONSE +18c client name: SMSG_MONSTER_INFO +18d client name: SMSG_PLAYER_SKILL_PRODUCE_MIX_LIST +18f client name: SMSG_PLAYER_SKILL_PRODUCE_EFFECT +191 client name: SMSG_CHAT_TALKIE_BOX +192 client name: SMSG_ADMIN_SET_TILE_TYPE +194 client name: SMSG_SOLVE_CHAR_NAME +196 client name: SMSG_BEING_STATUS_CHANGE +199 client name: SMSG_PVP_MAP_MODE +19a client name: SMSG_PVP_SET +19b client name: SMSG_BEING_SELFEFFECT +19e client name: SMSG_PET_CATCH_PROCESS +1a0 client name: SMSG_PET_ROULETTE +1a2 client name: SMSG_PET_STATUS +1a3 client name: SMSG_PET_FOOD +1a4 client name: SMSG_PET_DATA +1a6 client name: SMSG_PET_EGGS_LIST +1aa client name: SMSG_PET_MESSAGE +1ab client name: SMSG_BEING_STAT_UPDATE_1 +1ac client name: SMSG_SKILL_UNIT_UPDATE +1ad client name: SMSG_SKILL_ARROW_CREATE_LIST +1b0 client name: SMSG_CLASS_CHANGE +1b1 client name: SMSG_NPC_SHOW_DIGIT +1b3 client name: SMSG_NPC_CUTIN +1b4 client name: SMSG_GUILD_EMBLEM +1b6 client name: SMSG_GUILD_BASIC_INFO +1b9 client name: SMSG_SKILL_CAST_CANCEL +1c3 client name: SMSG_GM_CHAT2 +1c4 client name: SMSG_PLAYER_STORAGE_ADD +1c5 client name: SMSG_PLAYER_CART_ADD +1c8 client name: SMSG_PLAYER_INVENTORY_USE +1c9 client name: SMSG_GRAFFITI_VISIBLE +1cd client name: SMSG_PLAYER_SKILL_AUTO_SPELLS +1cf client name: SMSG_SKILL_DEVOTION_EFFECT +1d0 client name: SMSG_SPIRIT_BALLS +1d1 client name: SMSG_BLADE_STOP +1d2 client name: SMSG_COMBO_DELAY +1d3 client name: SMSG_BEING_SOUND_EFFECT +1d4 client name: SMSG_NPC_STR_INPUT +1d6 client name: SMSG_MAP_TYPE +1d7 client name: SMSG_BEING_CHANGE_LOOKS2 +1dc client name: SMSG_LOGIN_CODING_KEY +1de client name: SMSG_SKILL_DAMAGE +1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK +1e1 client name: SMSG_SPIRIT_BALL_SINGLE +1e6 client name: SMSG_FAMILY_CALL_PARTNER +1e9 client name: SMSG_PARTY_MEMBER_INFO +1ea client name: SMSG_WEDDING_EFFECT +1eb client name: SMSG_GUILD_UPDATE_COORDS +1f2 client name: SMSG_GUILD_MEMBER_LOGIN +1f3 client name: SMSG_BEING_SPECIAL_EFFECT +1f4 client name: SMSG_TRADE_REQUEST +1f5 client name: SMSG_TRADE_RESPONSE +1f6 client name: SMSG_FAMILY_ASK_FOR_CHILD +1fc client name: SMSG_PLAYER_REPAIR_LIST +1fe client name: SMSG_PLAYER_REPAIR_EFFECT +1ff client name: SMSG_BEING_SLIDE +201 client name: SMSG_FRIENDS_LIST +205 client name: SMSG_FAMILY_DIVORCED +206 client name: SMSG_FRIENDS_PLAYER_ONLINE +207 client name: SMSG_FRIENDS_REQUEST +209 client name: SMSG_FRIENDS_REQUEST_ACK +20a client name: SMSG_FRIENDS_DELETE_PLAYER +20d client name: SMSG_CHAR_BAN_CHAR_LIST +20e client name: SMSG_STARS_KILL +210 client name: SMSG_PVP_INFO +214 client name: SMSG_ADMIN_ACCOUNT_STATS +215 client name: SMSG_PLAYER_SKILL_MESSAGE +216 client name: SMSG_FAMILY_ASK_FOR_CHILD_REPLY +219 client name: SMSG_BLACKSMITH_RANKS_LIST +21a client name: SMSG_ALCHEMIST_RANKS_LIST +21b client name: SMSG_PLAYER_FAME_BLACKSMITH +21c client name: SMSG_PLAYER_FAME_ALCHEMIST +221 client name: SMSG_PLAYER_REFINE_LIST +223 client name: SMSG_PLAYER_UPGRADE_MESSAGE +224 client name: SMSG_PLAYER_FAME_TAEKWON +226 client name: SMSG_TAEKWON_RANKS_LIST +229 client name: SMSG_PLAYER_STATUS_CHANGE +22e client name: SMSG_HOMUNCULUS_INFO +22f client name: SMSG_HOMUNCULUS_FOOD +230 client name: SMSG_HOMUNCULUS_DATA +235 client name: SMSG_HOMUNCULUS_SKILLS +238 client name: SMSG_PK_RANKS_LIST +239 client name: SMSG_HOMUNCULUS_SKILL_UP +23a client name: SMSG_PLAYER_STORAGE_PASSWORD +23c client name: SMSG_PLAYER_STORAGE_PASSWORD_RESULT +240 client name: SMSG_MAIL_MAILS_LIST +242 client name: SMSG_MAIL_READ_MAIL +245 client name: SMSG_MAIL_GET_ATTACHMENT +249 client name: SMSG_MAIL_SEND_MAIL_ACK +24a client name: SMSG_MAIL_NEW_MAIL +250 client name: SMSG_AUCTION_MESSAGE +252 client name: SMSG_AUCTION_RESULTS +253 client name: SMSG_GLADIATOR_FEEL_REQUEST +255 client name: SMSG_MAIL_SET_ATTACHMENT_ACK +256 client name: SMSG_AUCTION_SET_ITEM +257 client name: SMSG_MAIL_DELETE_MAIL_ACK +25a client name: SMSG_PLAYER_COOKING_LIST +25d client name: CMSG_AUCTION_CLOSE +25f client name: SMSG_AUCTION_OPEN_WINDOW +260 client name: SMSG_MAIL_OPEN_WINDOW +274 client name: SMSG_MAIL_RETURN +283 client name: SMSG_MAP_ACCOUNT_ID +284 client name: SMSG_BEING_SPECIAL_EFFECT_NUM +287 client name: SMSG_NPC_CASH_SHOP_OPEN +289 client name: SMSG_NPC_CASH_BUY_ACK +28a client name: SMSG_PLAYER_STATUS_CHANGE2 +28e client name: SMSG_CHAR_CHECK_RENAME +290 client name: SMSG_CHAR_RENAME +291 client name: SMSG_FORMAT_MESSAGE +293 client name: SMSG_BOSS_MAP_INFO +294 client name: SMSG_PLAYER_READ_BOOK +298 client name: SMSG_PLAYER_ITEM_RENTAL_TIME +299 client name: SMSG_PLAYER_ITEM_RENTAL_EXPIRED +29b client name: SMSG_MERCENARY_INFO +29d client name: SMSG_MERCENARY_SKILLS +2a2 client name: SMSG_MERCENARY_UPDATE +2b1 client name: SMSG_QUEST_LIST +2b2 client name: SMSG_QUEST_LIST_OBJECTIVES +2b3 client name: SMSG_QUEST_ADD +2b4 client name: SMSG_QUEST_REMOVE +2b5 client name: SMSG_QUEST_UPDATE_OBJECTIVES +2b7 client name: SMSG_QUEST_ACTIVATE +2b8 client name: SMSG_PARTY_ITEM_PICKUP +2bb client name: SMSG_ITEM_DAMAGED +2c1 client name: SMSG_COLOR_MESSAGE +2c5 client name: SMSG_PARTY_INVITE_RESPONSE +2c6 client name: SMSG_PARTY_INVITED +2c9 client name: SMSG_PARTY_INVITATION_STATS +2cb client name: SMSG_INSTANCE_START +2cc client name: SMSG_INSTANCE_CREATE +2cd client name: SMSG_INSTANCE_INFO +2ce client name: SMSG_INSTANCE_DELETE +2d3 client name: SMSG_BIND_ITEM +2d9 client name: SMSG_PLAYER_EQUIP_TICK_ACK +2da client name: SMSG_PLAYER_SHOW_EQUIP +2dc client name: SMSG_BATTLE_CHAT_MESSAGE +2dd client name: SMSG_BATTLE_EMBLEM +2de client name: SMSG_BATTLE_UPDATE_SCORE +2df client name: SMSG_BATTLE_UPDATE_COORDS +2e0 client name: SMSG_BATTLE_UPDATE_HP +2eb client name: SMSG_MAP_LOGIN_SUCCESS +2ef client name: SMSG_BEING_FONT +2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR +2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT +43d client name: SMSG_PLAYER_SKILL_COOLDOWN +43f client name: SMSG_BEING_STATUS_CHANGE +440 client name: SMSG_BEING_MILLENIUM_SHIELD +441 client name: SMSG_PLAYER_DELETE_SKILL +442 client name: SMSG_AUTOSHADOW_SPELL_LIST +446 client name: SMSG_QUEST_NPC_EFFECT +7d8 client name: SMSG_PARTY_SETTINGS +7d9 client name: SMSG_PLAYER_SHORTCUTS +7e1 client name: SMSG_PLAYER_UPDATE_SKILL +7e2 client name: SMSG_FORMAT_MESSAGE_NUMBER +7e3 client name: SMSG_SKILL_ITEM_LIST_WINDOW +7e6 client name: SMSG_FORMAT_MESSAGE_SKILL +7e9 client name: SMSG_CHAR_CAPTCHA_NOT_SUPPORTED +7f6 client name: SMSG_PLAYER_GET_EXP +7fa client name: SMSG_PLAYER_INVENTORY_REMOVE2 +7fb client name: SMSG_SKILL_CASTING +7fc client name: SMSG_PARTY_LEADER +7fd client name: SMSG_ITEM_MVP_DROPPED +7fe client name: SMSG_BATTLE_PLAY +800 client name: SMSG_VENDING_ITEMS_LIST +803 client name: SMSG_BOOKING_REGISTER_ACK +805 client name: SMSG_BOOKING_SEARCH_ACK +807 client name: SMSG_BOOKING_DELETE_ACK +809 client name: SMSG_BOOKING_INSERT_NOTIFY +80a client name: SMSG_BOOKING_UPDATE_NOTIFY +80b client name: SMSG_BOOKING_DELETE_NOTIFY +80e client name: SMSG_PLAYER_HP +80f client name: SMSG_TRADE_ITEM_ADD +810 client name: SMSG_BUYINGSTORE_OPEN +812 client name: SMSG_BUYINGSTORE_CREATE_FAILED +813 client name: SMSG_BUYINGSTORE_OWN_ITEMS +814 client name: SMSG_BUYINGSTORE_SHOW_BOARD +816 client name: SMSG_BUYINGSTORE_HIDE_BOARD +818 client name: SMSG_BUYINGSTORE_ITEMS_LIST +81a client name: SMSG_BUYINGSTORE_SELL_FAILED +81b client name: SMSG_BUYINGSTORE_REPORT +81c client name: SMSG_BUYINGSTORE_DELETE_ITEM +81d client name: SMSG_ELEMENTAL_INFO +81e client name: SMSG_ELEMENTAL_UPDATE_STATUS +824 client name: SMSG_BUYINGSTORE_SELLER_SELL_FAILED +828 client name: SMSG_CHAR_DELETE2_ACK +82a client name: SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK +82c client name: SMSG_CHAR_DELETE2_CANCEL_ACK +82d client name: SMSG_CHAR_LOGIN2 +836 client name: SMSG_SEARCHSTORE_SEARCH_ACK +837 client name: SMSG_SEARCHSTORE_SEARCH_FAILED +83a client name: SMSG_SEARCHSTORE_OPEN +83d client name: SMSG_SEARCHSTORE_CLICK_ACK +83e client name: SMSG_LOGIN_ERROR2 +840 client name: SMSG_MAP_NOT_FOUND +845 client name: SMSG_NPC_CASH_POINTS +849 client name: SMSG_NPC_CASH_BUY +84b client name: SMSG_ITEM_DROPPED +8b3 client name: SMSG_SCRIPT_MESSAGE +8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST +8c8 client name: SMSG_BEING_ACTION2 +8ca client name: SMSG_NPC_CASH_SCHEDULE +8cf client name: SMSG_BEING_CHARM +8d2 client name: SMSG_SKILL_SNAP +8d5 client name: SMSG_CHAR_CHANGE_SLOT +8d6 client name: SMSG_NPC_CLOSE_TIMEOUT +8d8 client name: SMSG_BATTLE_QUEUE_ACK +8d9 client name: SMSG_BATTLE_JOINED +8db client name: SMSG_BATTLE_NOTICE_DELETE +8df client name: SMSG_BATTLE_BEGINS +908 client name: SMSG_PLAYER_FAVORITE_ITEM +96d client name: SMSG_MERGE_ITEM +96f client name: SMSG_ACK_MERGE_ITEMS +977 client name: SMSG_MONSTER_HP +97d client name: SMSG_RANKS_LIST +97e client name: SMSG_PLAYER_RANK_POINTS +983 client name: SMSG_BEING_STATUS_CHANGE +985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST +990 client name: SMSG_PLAYER_INVENTORY_ADD +991 client name: SMSG_PLAYER_INVENTORY +992 client name: SMSG_PLAYER_EQUIPMENT +993 client name: SMSG_PLAYER_CART_ITEMS +994 client name: SMSG_PLAYER_CART_EQUIP +995 client name: SMSG_PLAYER_STORAGE_ITEMS +996 client name: SMSG_PLAYER_STORAGE_EQUIP +997 client name: SMSG_BEING_VIEW_EQUIPMENT +999 client name: SMSG_PLAYER_EQUIP +99a client name: SMSG_PLAYER_UNEQUIP +99b client name: SMSG_MAP_TYPE_PROPERTY2 +99d client name: SMSG_CHAR_CHARACTERS +9a6 client name: SMSG_BANK_STATUS +9a8 client name: SMSG_BANK_DEPOSIT +9aa client name: SMSG_BANK_WITHDRAW +9ca client name: SMSG_SKILL_ENTRY +9d5 client name: SMSG_NPC_MARKET_OPEN +9d7 client name: SMSG_NPC_MARKET_BUY_ACK +9db client name: SMSG_BEING_MOVE +9dc client name: SMSG_BEING_SPAWN +9dd client name: SMSG_BEING_VISIBLE +9df client name: SMSG_WHISPER_RESPONSE +a02 +a1a +a1c +a20 +a22 +2711 +2713 +2716 +2717 +2718 +2719 +2722 +2723 +2728 +272b +272c +272d +272e +2731 +2734 +2735 +2736 +2737 +2740 +2af9 +2afb +2afd +2b00 +2b03 +2b04 +2b06 +2b09 +2b0d +2b0f +2b12 +2b14 +2b1b +2b1d +2b1e +2b20 +2b21 +2b22 +2b24 +2b25 +2b27 diff --git a/servergreps/hercules/20140403/src/char.c b/servergreps/hercules/20140403/src/char.c new file mode 100644 index 0000000..7658eff --- /dev/null +++ b/servergreps/hercules/20140403/src/char.c @@ -0,0 +1,16373 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ +# 892 "../../../server-code/src/char/char.c" + if (sex == 'M' || sex == 'F') { + if (!sd) { + + (showmsg->showWarning(("Character '%s' (CID: %d, AID: %d) has sex '%c', but PACKETVER does not support per-character sex. Defaulting to 'U'.\n"), p->name, p->char_id, p->account_id, sex)) + ; + return 99; + } + if ((sex == 'M' && sd->sex == SEX_FEMALE) + || (sex == 'F' && sd->sex == SEX_MALE)) { + (showmsg->showWarning(("Changing sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + chr->changecharsex(p->char_id, sd->sex); + } else { + (showmsg->showInfo(("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n"), p->name, p->char_id, p->account_id)); + } + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", char_db, p->char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 907)); + } + } + return 99; + +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + + + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20140403/src/clif.c b/servergreps/hercules/20140403/src/clif.c new file mode 100644 index 0000000..143fc55 --- /dev/null +++ b/servergreps/hercules/20140403/src/clif.c @@ -0,0 +1,46818 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A7), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0940), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0361), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0367), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0802), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0360), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x096A), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0965), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x096A), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0965), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0966), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x095D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x092D), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0815), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0436), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0361), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0438), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x07E4), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0934), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095e), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0946), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0868), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0950), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0882), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x085B), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x092D), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0965), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x085D), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0933), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x091F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x023B), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0867), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0944), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x08AC), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0883), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0920), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0890), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0896), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); + + + + + + do { clif->cryptKey[0] = (0x63224335); clif->cryptKey[1] = (0x0F3A1F27); clif->cryptKey[2] = (0x6D217B24); } while(0); + + + + do { clif->cryptKey[0] = (0x63DC7BDC); clif->cryptKey[1] = (0x7BDC7BDC); clif->cryptKey[2] = (0x7BDC7BDC); } while(0); + + + + do { clif->cryptKey[0] = (0x116763F2); clif->cryptKey[1] = (0x41117DAC); clif->cryptKey[2] = (0x7FD13C45); } while(0); + + + + do { clif->cryptKey[0] = (0x15D3271C); clif->cryptKey[1] = (0x004D725B); clif->cryptKey[2] = (0x111A3A37); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20140403/src/login.c b/servergreps/hercules/20140403/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20140403/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20140403/uselesspackets.txt b/servergreps/hercules/20140403/uselesspackets.txt new file mode 100644 index 0000000..7d3dc6c --- /dev/null +++ b/servergreps/hercules/20140403/uselesspackets.txt @@ -0,0 +1,29 @@ +Useless packet 0a01. +Useless packet 08fc. +Useless packet 0200. +Useless packet 08d4. +Useless packet 7530. +Useless packet 028f. +Useless packet 091a. +Useless packet 0970. +Useless packet 0066. +Useless packet 0187. +Useless packet 08ba. +Useless packet 0064. +Useless packet 0065. +Useless packet 0061. +Useless packet 0068. +Useless packet 0a35. +Useless packet 027c. +Useless packet 0b07. +Useless packet 0b09. +Useless packet 0b11. +Useless packet 0b13. +Useless packet 0b12. +Useless packet 0b15. +Useless packet 0b14. +Useless packet 0b0f. +Useless packet 0b0d. +Useless packet 0b0e. +Useless packet 0b0c. +Useless packet 0980. diff --git a/servergreps/hercules/20141016/serverpackets.txt b/servergreps/hercules/20141016/serverpackets.txt index 5f26b3d..c387529 100644 --- a/servergreps/hercules/20141016/serverpackets.txt +++ b/servergreps/hercules/20141016/serverpackets.txt @@ -41,7 +41,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -60,7 +59,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -72,11 +70,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -87,10 +81,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -102,7 +93,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -111,7 +101,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -145,7 +134,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -193,8 +181,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -296,7 +282,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -350,7 +335,6 @@ fe client name: SMSG_PARTY_INVITED 849 client name: SMSG_NPC_CASH_BUY 84b client name: SMSG_ITEM_DROPPED 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8c8 client name: SMSG_BEING_ACTION2 8ca client name: SMSG_NPC_CASH_SCHEDULE @@ -362,24 +346,12 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP 97d client name: SMSG_RANKS_LIST 97e client name: SMSG_PLAYER_RANK_POINTS -97f 983 client name: SMSG_BEING_STATUS_CHANGE 985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 990 client name: SMSG_PLAYER_INVENTORY_ADD @@ -409,23 +381,15 @@ a1a client name: SMSG_ROULETTE_OPEN_ACK a1c client name: SMSG_ROULETTE_INFO_ACK_TYPE a20 client name: SMSG_ROULETTE_GENERATE_ACK_TYPE a22 client name: SMSG_ROULETTE_RECV_ITEM_ACK -a28 -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +399,25 @@ a28 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20141016/src/char.c b/servergreps/hercules/20141016/src/char.c new file mode 100644 index 0000000..cde0244 --- /dev/null +++ b/servergreps/hercules/20141016/src/char.c @@ -0,0 +1,16364 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ + + (void)sd; (void)p; + switch (sex) { + case 'M': + return SEX_MALE; + case 'F': + return SEX_FEMALE; + case 'U': + default: + return 99; + } +# 912 "../../../server-code/src/char/char.c" +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; +# 1885 "../../../server-code/src/char/char.c" + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + WBUFB(buf,140) = p->sex; + offset += 1; + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20141016/src/clif.c b/servergreps/hercules/20141016/src/clif.c new file mode 100644 index 0000000..ca7975e --- /dev/null +++ b/servergreps/hercules/20141016/src/clif.c @@ -0,0 +1,46909 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + p.sex = sd->status.sex; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +# 6329 "../../../server-code/src/map/clif.c" +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + + + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; +# 15711 "../../../server-code/src/map/clif.c" + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A7), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0940), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0361), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0367), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0802), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0360), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x096A), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0965), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x096A), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0965), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0966), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x095D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x092D), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0815), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0436), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0361), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0438), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x07E4), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0934), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095e), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0946), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0868), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0950), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0882), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x085B), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x092D), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0965), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x085D), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0933), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x091F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x023B), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0867), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0944), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x08AC), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0883), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0920), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0890), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0896), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0967), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x022D), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x086E), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x094B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0364), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + packetdb_addpacket((0x0a00), (269), 0xFFFF); + + + + + packetdb_addpacket((0x0A19), (2),clif->pRouletteOpen,0, 0xFFFF); + packetdb_addpacket((0x0A1A), (23), 0xFFFF); + packetdb_addpacket((0x0A1B), (2),clif->pRouletteInfo,0, 0xFFFF); + packetdb_addpacket((0x0A1C), (-1), 0xFFFF); + packetdb_addpacket((0x0A1D), (2),clif->pRouletteClose,0, 0xFFFF); + packetdb_addpacket((0x0A1E), (3), 0xFFFF); + packetdb_addpacket((0x0A1F), (2),clif->pRouletteGenerate,0, 0xFFFF); + packetdb_addpacket((0x0A20), (21), 0xFFFF); + packetdb_addpacket((0x0A21), (3),clif->pRouletteRecvItem,2, 0xFFFF); + packetdb_addpacket((0x0A22), (5), 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); + + + + + + do { clif->cryptKey[0] = (0x63224335); clif->cryptKey[1] = (0x0F3A1F27); clif->cryptKey[2] = (0x6D217B24); } while(0); + + + + do { clif->cryptKey[0] = (0x63DC7BDC); clif->cryptKey[1] = (0x7BDC7BDC); clif->cryptKey[2] = (0x7BDC7BDC); } while(0); + + + + do { clif->cryptKey[0] = (0x116763F2); clif->cryptKey[1] = (0x41117DAC); clif->cryptKey[2] = (0x7FD13C45); } while(0); + + + + do { clif->cryptKey[0] = (0x15D3271C); clif->cryptKey[1] = (0x004D725B); clif->cryptKey[2] = (0x111A3A37); } while(0); + + + + do { clif->cryptKey[0] = (0x04810281); clif->cryptKey[1] = (0x42814281); clif->cryptKey[2] = (0x42814281); } while(0); + + + + do { clif->cryptKey[0] = (0x2DFF467C); clif->cryptKey[1] = (0x444B37EE); clif->cryptKey[2] = (0x2C1B634F); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20141016/src/login.c b/servergreps/hercules/20141016/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20141016/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20141022/serverpackets.txt b/servergreps/hercules/20141022/serverpackets.txt index 2385f21..f1ec170 100644 --- a/servergreps/hercules/20141022/serverpackets.txt +++ b/servergreps/hercules/20141022/serverpackets.txt @@ -41,7 +41,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -60,7 +59,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -72,11 +70,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -87,10 +81,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -102,7 +93,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -111,7 +101,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -145,7 +134,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -193,8 +181,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -294,7 +280,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -347,7 +332,6 @@ fe client name: SMSG_PARTY_INVITED 849 client name: SMSG_NPC_CASH_BUY 84b client name: SMSG_ITEM_DROPPED 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8c8 client name: SMSG_BEING_ACTION2 8ca client name: SMSG_NPC_CASH_SCHEDULE @@ -359,25 +343,13 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP 97a client name: SMSG_QUEST_LIST 97d client name: SMSG_RANKS_LIST 97e client name: SMSG_PLAYER_RANK_POINTS -97f 983 client name: SMSG_BEING_STATUS_CHANGE 985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 990 client name: SMSG_PLAYER_INVENTORY_ADD @@ -410,22 +382,15 @@ a1c client name: SMSG_ROULETTE_INFO_ACK_TYPE a20 client name: SMSG_ROULETTE_GENERATE_ACK_TYPE a22 client name: SMSG_ROULETTE_RECV_ITEM_ACK a28 client name: SMSG_VENDING_OPEN_STATUS -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +400,25 @@ a28 client name: SMSG_VENDING_OPEN_STATUS 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20141022/src/char.c b/servergreps/hercules/20141022/src/char.c new file mode 100644 index 0000000..793ea73 --- /dev/null +++ b/servergreps/hercules/20141022/src/char.c @@ -0,0 +1,16371 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ + + (void)sd; (void)p; + switch (sex) { + case 'M': + return SEX_MALE; + case 'F': + return SEX_FEMALE; + case 'U': + default: + return 99; + } +# 912 "../../../server-code/src/char/char.c" +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; + + WBUFW(buf,56) = p->body; + offset+=2; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + WBUFB(buf,140) = p->sex; + offset += 1; + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20141022/src/clif.c b/servergreps/hercules/20141022/src/clif.c new file mode 100644 index 0000000..bb1744c --- /dev/null +++ b/servergreps/hercules/20141022/src/clif.c @@ -0,0 +1,46955 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + p.sex = sd->status.sex; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; +# 2389 "../../../server-code/src/map/clif.c" + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; +# 2516 "../../../server-code/src/map/clif.c" +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + clif->messagecolor_self(fd, 0x00ff00U, mes); +# 5508 "../../../server-code/src/map/clif.c" + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + + + const int item_length = 22; + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + + + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + + WFIFOHEAD(fd, 3); + WFIFOW(fd,0) = 0xa28; + WFIFOB(fd, 2) = 0; + WFIFOSET(fd, 3); + +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + p.Rotate = sd->status.hotkey_rowshift; + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + int j; + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; + + info->quest_svrTime = sd->quest_log[i].time - qi->time; + info->quest_endTime = sd->quest_log[i].time; + info->hunting_count = qi->objectives_count; + + for (j = 0; j < qi->objectives_count; j++) { + struct mob_db *mob_data; + if (( (j < 3) ? +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15700 "../../../server-code/src/map/clif.c" + : (nullpo->assert_report("../../../server-code/src/map/clif.c", 15700, __func__, "j < 3", "failed assertion"), +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15700 "../../../server-code/src/map/clif.c" + ) )) break; else (void)0; + real_len += sizeof(info->objectives[j]); + + mob_data = mob->db(qi->objectives[j].mob); + + info->objectives[j].mob_id = qi->objectives[j].mob; + info->objectives[j].huntCount = sd->quest_log[i].count[j]; + info->objectives[j].maxCount = qi->objectives[j].count; + (strlib->safestrncpy_((info->objectives[j].mobName),(mob_data->jname),(sizeof(info->objectives[j].mobName)))); + } + + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A7), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0940), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0361), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0367), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0802), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0360), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x096A), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0965), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x096A), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0965), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0966), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x095D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x092D), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0815), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0436), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0361), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0438), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x07E4), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0934), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095e), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0946), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0868), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0950), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0882), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x085B), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x092D), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0965), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x085D), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0933), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x091F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x023B), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0867), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0944), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x08AC), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0883), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0920), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0890), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0896), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0967), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x022D), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x086E), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x094B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0364), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + packetdb_addpacket((0x0a00), (269), 0xFFFF); + + + + + packetdb_addpacket((0x0A19), (2),clif->pRouletteOpen,0, 0xFFFF); + packetdb_addpacket((0x0A1A), (23), 0xFFFF); + packetdb_addpacket((0x0A1B), (2),clif->pRouletteInfo,0, 0xFFFF); + packetdb_addpacket((0x0A1C), (-1), 0xFFFF); + packetdb_addpacket((0x0A1D), (2),clif->pRouletteClose,0, 0xFFFF); + packetdb_addpacket((0x0A1E), (3), 0xFFFF); + packetdb_addpacket((0x0A1F), (2),clif->pRouletteGenerate,0, 0xFFFF); + packetdb_addpacket((0x0A20), (21), 0xFFFF); + packetdb_addpacket((0x0A21), (3),clif->pRouletteRecvItem,2, 0xFFFF); + packetdb_addpacket((0x0A22), (5), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08AD), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x094E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x087D), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0878), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AA), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x023B), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0835), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0940), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0955), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x093B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0896), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x091A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0899), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0A01), (3),clif->pHotkeyRowShift,2, 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); + + + + + + do { clif->cryptKey[0] = (0x63224335); clif->cryptKey[1] = (0x0F3A1F27); clif->cryptKey[2] = (0x6D217B24); } while(0); + + + + do { clif->cryptKey[0] = (0x63DC7BDC); clif->cryptKey[1] = (0x7BDC7BDC); clif->cryptKey[2] = (0x7BDC7BDC); } while(0); + + + + do { clif->cryptKey[0] = (0x116763F2); clif->cryptKey[1] = (0x41117DAC); clif->cryptKey[2] = (0x7FD13C45); } while(0); + + + + do { clif->cryptKey[0] = (0x15D3271C); clif->cryptKey[1] = (0x004D725B); clif->cryptKey[2] = (0x111A3A37); } while(0); + + + + do { clif->cryptKey[0] = (0x04810281); clif->cryptKey[1] = (0x42814281); clif->cryptKey[2] = (0x42814281); } while(0); + + + + do { clif->cryptKey[0] = (0x2DFF467C); clif->cryptKey[1] = (0x444B37EE); clif->cryptKey[2] = (0x2C1B634F); } while(0); + + + + do { clif->cryptKey[0] = (0x290551EA); clif->cryptKey[1] = (0x2B952C75); clif->cryptKey[2] = (0x2D67669B); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20141022/src/login.c b/servergreps/hercules/20141022/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20141022/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20150226/serverpackets.txt b/servergreps/hercules/20150226/serverpackets.txt index 52e8e17..24182a1 100644 --- a/servergreps/hercules/20150226/serverpackets.txt +++ b/servergreps/hercules/20150226/serverpackets.txt @@ -41,7 +41,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -60,7 +59,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -72,11 +70,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -87,10 +81,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -102,7 +93,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -111,7 +101,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -145,7 +134,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -191,8 +179,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -292,7 +278,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -344,7 +329,6 @@ fe client name: SMSG_PARTY_INVITED 849 client name: SMSG_NPC_CASH_BUY 84b client name: SMSG_ITEM_DROPPED 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8c8 client name: SMSG_BEING_ACTION2 8ca client name: SMSG_NPC_CASH_SCHEDULE @@ -356,25 +340,13 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP 97a client name: SMSG_QUEST_LIST 97d client name: SMSG_RANKS_LIST 97e client name: SMSG_PLAYER_RANK_POINTS -97f 983 client name: SMSG_BEING_STATUS_CHANGE 985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 991 client name: SMSG_PLAYER_INVENTORY @@ -410,22 +382,15 @@ a20 client name: SMSG_ROULETTE_GENERATE_ACK_TYPE a22 client name: SMSG_ROULETTE_RECV_ITEM_ACK a28 client name: SMSG_VENDING_OPEN_STATUS a2d client name: SMSG_BEING_VIEW_EQUIPMENT -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +400,25 @@ a2d client name: SMSG_BEING_VIEW_EQUIPMENT 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20150226/src/char.c b/servergreps/hercules/20150226/src/char.c new file mode 100644 index 0000000..793ea73 --- /dev/null +++ b/servergreps/hercules/20150226/src/char.c @@ -0,0 +1,16371 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ + + (void)sd; (void)p; + switch (sex) { + case 'M': + return SEX_MALE; + case 'F': + return SEX_FEMALE; + case 'U': + default: + return 99; + } +# 912 "../../../server-code/src/char/char.c" +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; + + WBUFW(buf,56) = p->body; + offset+=2; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + WBUFB(buf,140) = p->sex; + offset += 1; + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20150226/src/clif.c b/servergreps/hercules/20150226/src/clif.c new file mode 100644 index 0000000..7c64106 --- /dev/null +++ b/servergreps/hercules/20150226/src/clif.c @@ -0,0 +1,46996 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + p.sex = sd->status.sex; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + + + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + int i; + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; + + + for (i=0; i<5; i++){ + p.option_data[i].index = 0; + p.option_data[i].value = 0; + p.option_data[i].param = 0; + } + + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + int j; + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + + + + p->option_count = 0; + for (j=0; j<5; j++){ + p->option_data[j].index = 0; + p->option_data[j].value = 0; + p->option_data[j].param = 0; + } + +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + clif->add_random_options(WFIFOP(fd,21+offset), i); + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + clif->add_random_options(WBUFP(buf,21+offset), &sd->status.cart[n]); + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + const int item_length = 47; + + + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + clif->add_random_options(WFIFOP(fd,offset+22+i*item_length), &vsd->status.cart[index]); + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + const int item_length = 47; + + + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + clif->add_random_options(WFIFOP(fd,30+22+i*item_length), &sd->status.cart[index]); + + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + + WFIFOHEAD(fd, 3); + WFIFOW(fd,0) = 0xa28; + WFIFOB(fd, 2) = 0; + WFIFOSET(fd, 3); + +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + p.Rotate = sd->status.hotkey_rowshift; + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + int j; + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; + + info->quest_svrTime = sd->quest_log[i].time - qi->time; + info->quest_endTime = sd->quest_log[i].time; + info->hunting_count = qi->objectives_count; + + for (j = 0; j < qi->objectives_count; j++) { + struct mob_db *mob_data; + if (( (j < 3) ? +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15700 "../../../server-code/src/map/clif.c" + : (nullpo->assert_report("../../../server-code/src/map/clif.c", 15700, __func__, "j < 3", "failed assertion"), +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15700 "../../../server-code/src/map/clif.c" + ) )) break; else (void)0; + real_len += sizeof(info->objectives[j]); + + mob_data = mob->db(qi->objectives[j].mob); + + info->objectives[j].mob_id = qi->objectives[j].mob; + info->objectives[j].huntCount = sd->quest_log[i].count[j]; + info->objectives[j].maxCount = qi->objectives[j].count; + (strlib->safestrncpy_((info->objectives[j].mobName),(mob_data->jname),(sizeof(info->objectives[j].mobName)))); + } + + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A7), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0940), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0361), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0367), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0802), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0360), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x096A), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0965), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x096A), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0965), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0966), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x095D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x092D), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0815), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0436), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0361), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0438), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x07E4), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0934), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095e), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0946), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0868), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0950), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0882), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x085B), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x092D), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0965), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x085D), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0933), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x091F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x023B), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0867), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0944), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x08AC), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0883), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0920), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0890), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0896), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0967), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x022D), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x086E), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x094B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0364), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + packetdb_addpacket((0x0a00), (269), 0xFFFF); + + + + + packetdb_addpacket((0x0A19), (2),clif->pRouletteOpen,0, 0xFFFF); + packetdb_addpacket((0x0A1A), (23), 0xFFFF); + packetdb_addpacket((0x0A1B), (2),clif->pRouletteInfo,0, 0xFFFF); + packetdb_addpacket((0x0A1C), (-1), 0xFFFF); + packetdb_addpacket((0x0A1D), (2),clif->pRouletteClose,0, 0xFFFF); + packetdb_addpacket((0x0A1E), (3), 0xFFFF); + packetdb_addpacket((0x0A1F), (2),clif->pRouletteGenerate,0, 0xFFFF); + packetdb_addpacket((0x0A20), (21), 0xFFFF); + packetdb_addpacket((0x0A21), (3),clif->pRouletteRecvItem,2, 0xFFFF); + packetdb_addpacket((0x0A22), (5), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08AD), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x094E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x087D), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0878), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AA), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x023B), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0835), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0940), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0955), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x093B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0896), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x091A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0899), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0A01), (3),clif->pHotkeyRowShift,2, 0xFFFF); + + + + packetdb_addpacket((0x0A09), (45), 0xFFFF); + packetdb_addpacket((0x0A0A), (47), 0xFFFF); + packetdb_addpacket((0x0A0B), (47), 0xFFFF); + packetdb_addpacket((0x0A0C), (56), 0xFFFF); + packetdb_addpacket((0x0A0D), (-1), 0xFFFF); + packetdb_addpacket((0x0A0F), (-1), 0xFFFF); + packetdb_addpacket((0x0A10), (-1), 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); + + + + + + do { clif->cryptKey[0] = (0x63224335); clif->cryptKey[1] = (0x0F3A1F27); clif->cryptKey[2] = (0x6D217B24); } while(0); + + + + do { clif->cryptKey[0] = (0x63DC7BDC); clif->cryptKey[1] = (0x7BDC7BDC); clif->cryptKey[2] = (0x7BDC7BDC); } while(0); + + + + do { clif->cryptKey[0] = (0x116763F2); clif->cryptKey[1] = (0x41117DAC); clif->cryptKey[2] = (0x7FD13C45); } while(0); + + + + do { clif->cryptKey[0] = (0x15D3271C); clif->cryptKey[1] = (0x004D725B); clif->cryptKey[2] = (0x111A3A37); } while(0); + + + + do { clif->cryptKey[0] = (0x04810281); clif->cryptKey[1] = (0x42814281); clif->cryptKey[2] = (0x42814281); } while(0); + + + + do { clif->cryptKey[0] = (0x2DFF467C); clif->cryptKey[1] = (0x444B37EE); clif->cryptKey[2] = (0x2C1B634F); } while(0); + + + + do { clif->cryptKey[0] = (0x290551EA); clif->cryptKey[1] = (0x2B952C75); clif->cryptKey[2] = (0x2D67669B); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20150226/src/login.c b/servergreps/hercules/20150226/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20150226/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20150513/serverpackets.txt b/servergreps/hercules/20150513/serverpackets.txt index e950620..2a7e056 100644 --- a/servergreps/hercules/20150513/serverpackets.txt +++ b/servergreps/hercules/20150513/serverpackets.txt @@ -41,7 +41,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -60,7 +59,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -72,11 +70,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -87,10 +81,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -102,7 +93,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -111,7 +101,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -145,7 +134,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -191,8 +179,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -292,7 +278,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -344,7 +329,6 @@ fe client name: SMSG_PARTY_INVITED 849 client name: SMSG_NPC_CASH_BUY 84b client name: SMSG_ITEM_DROPPED 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8c8 client name: SMSG_BEING_ACTION2 8ca client name: SMSG_NPC_CASH_SCHEDULE @@ -356,25 +340,13 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP 97a client name: SMSG_QUEST_LIST 97d client name: SMSG_RANKS_LIST 97e client name: SMSG_PLAYER_RANK_POINTS -97f 983 client name: SMSG_BEING_STATUS_CHANGE 985 client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 991 client name: SMSG_PLAYER_INVENTORY @@ -410,22 +382,15 @@ a20 client name: SMSG_ROULETTE_GENERATE_ACK_TYPE a22 client name: SMSG_ROULETTE_RECV_ITEM_ACK a28 client name: SMSG_VENDING_OPEN_STATUS a2d client name: SMSG_BEING_VIEW_EQUIPMENT -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +400,25 @@ a2d client name: SMSG_BEING_VIEW_EQUIPMENT 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20150513/src/char.c b/servergreps/hercules/20150513/src/char.c new file mode 100644 index 0000000..793ea73 --- /dev/null +++ b/servergreps/hercules/20150513/src/char.c @@ -0,0 +1,16371 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ + + (void)sd; (void)p; + switch (sex) { + case 'M': + return SEX_MALE; + case 'F': + return SEX_FEMALE; + case 'U': + default: + return 99; + } +# 912 "../../../server-code/src/char/char.c" +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; + + WBUFW(buf,56) = p->body; + offset+=2; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + WBUFB(buf,140) = p->sex; + offset += 1; + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20150513/src/clif.c b/servergreps/hercules/20150513/src/clif.c new file mode 100644 index 0000000..0cfe8a3 --- /dev/null +++ b/servergreps/hercules/20150513/src/clif.c @@ -0,0 +1,47040 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + p.sex = sd->status.sex; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + p.body = vd->body_style; + (strlib->safestrncpy_((p.name),(clif->get_bl_name(bl)),((23 + 1)))); + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + p.body = vd->body_style; + (strlib->safestrncpy_((p.name),(clif->get_bl_name(bl)),((23 + 1)))); + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + p.body = vd->body_style; + (strlib->safestrncpy_((p.name),(clif->get_bl_name(bl)),((23 + 1)))); + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + int i; + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; + + + for (i=0; i<5; i++){ + p.option_data[i].index = 0; + p.option_data[i].value = 0; + p.option_data[i].param = 0; + } + + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + int j; + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + + + + p->option_count = 0; + for (j=0; j<5; j++){ + p->option_data[j].index = 0; + p->option_data[j].value = 0; + p->option_data[j].param = 0; + } + +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + clif->add_random_options(WFIFOP(fd,21+offset), i); + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + clif->add_random_options(WBUFP(buf,21+offset), &sd->status.cart[n]); + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + const int item_length = 47; + + + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + clif->add_random_options(WFIFOP(fd,offset+22+i*item_length), &vsd->status.cart[index]); + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + const int item_length = 47; + + + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + clif->add_random_options(WFIFOP(fd,30+22+i*item_length), &sd->status.cart[index]); + + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + + WFIFOHEAD(fd, 3); + WFIFOW(fd,0) = 0xa28; + WFIFOB(fd, 2) = 0; + WFIFOSET(fd, 3); + +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + p.Rotate = sd->status.hotkey_rowshift; + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +# 10928 "../../../server-code/src/map/clif.c" +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + int j; + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; + + info->quest_svrTime = sd->quest_log[i].time - qi->time; + info->quest_endTime = sd->quest_log[i].time; + info->hunting_count = qi->objectives_count; + + for (j = 0; j < qi->objectives_count; j++) { + struct mob_db *mob_data; + if (( (j < 3) ? +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15700 "../../../server-code/src/map/clif.c" + : (nullpo->assert_report("../../../server-code/src/map/clif.c", 15700, __func__, "j < 3", "failed assertion"), +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15700 "../../../server-code/src/map/clif.c" + ) )) break; else (void)0; + real_len += sizeof(info->objectives[j]); + + mob_data = mob->db(qi->objectives[j].mob); + + info->objectives[j].mob_id = qi->objectives[j].mob; + info->objectives[j].huntCount = sd->quest_log[i].count[j]; + info->objectives[j].maxCount = qi->objectives[j].count; + (strlib->safestrncpy_((info->objectives[j].mobName),(mob_data->jname),(sizeof(info->objectives[j].mobName)))); + } + + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ +# 18770 "../../../server-code/src/map/clif.c" +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A7), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0940), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0361), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0367), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0802), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0360), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x096A), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0965), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x096A), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0965), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0966), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x095D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x092D), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0815), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0436), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0361), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0438), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x07E4), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0934), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095e), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0946), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0868), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0950), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0882), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x085B), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x092D), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0965), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x085D), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0933), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x091F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x023B), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0867), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0944), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x08AC), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0883), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0920), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0890), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0896), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0967), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x022D), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x086E), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x094B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0364), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + packetdb_addpacket((0x0a00), (269), 0xFFFF); + + + + + packetdb_addpacket((0x0A19), (2),clif->pRouletteOpen,0, 0xFFFF); + packetdb_addpacket((0x0A1A), (23), 0xFFFF); + packetdb_addpacket((0x0A1B), (2),clif->pRouletteInfo,0, 0xFFFF); + packetdb_addpacket((0x0A1C), (-1), 0xFFFF); + packetdb_addpacket((0x0A1D), (2),clif->pRouletteClose,0, 0xFFFF); + packetdb_addpacket((0x0A1E), (3), 0xFFFF); + packetdb_addpacket((0x0A1F), (2),clif->pRouletteGenerate,0, 0xFFFF); + packetdb_addpacket((0x0A20), (21), 0xFFFF); + packetdb_addpacket((0x0A21), (3),clif->pRouletteRecvItem,2, 0xFFFF); + packetdb_addpacket((0x0A22), (5), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08AD), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x094E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x087D), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0878), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AA), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x023B), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0835), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0940), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0955), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x093B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0896), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x091A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0899), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0A01), (3),clif->pHotkeyRowShift,2, 0xFFFF); + + + + packetdb_addpacket((0x0A09), (45), 0xFFFF); + packetdb_addpacket((0x0A0A), (47), 0xFFFF); + packetdb_addpacket((0x0A0B), (47), 0xFFFF); + packetdb_addpacket((0x0A0C), (56), 0xFFFF); + packetdb_addpacket((0x0A0D), (-1), 0xFFFF); + packetdb_addpacket((0x0A0F), (-1), 0xFFFF); + packetdb_addpacket((0x0A10), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0924), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0879), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x022D), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0883), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x02C4), (8), 0xFFFF); + packetdb_addpacket((0x0960), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x094A), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0927), (4), 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0817), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0923), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09E8), (11),clif->pDull, 0xFFFF); + packetdb_addpacket((0x0A2E), (6),clif->pDull, 0xFFFF); + packetdb_addpacket((0x0A02), (4), 0xFFFF); + packetdb_addpacket((0x0A35), (4),clif->pOneClick_ItemIdentify,2, 0xFFFF); +# 2926 "../../../server-code/src/map/packets.h" + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); + + + + + + do { clif->cryptKey[0] = (0x63224335); clif->cryptKey[1] = (0x0F3A1F27); clif->cryptKey[2] = (0x6D217B24); } while(0); + + + + do { clif->cryptKey[0] = (0x63DC7BDC); clif->cryptKey[1] = (0x7BDC7BDC); clif->cryptKey[2] = (0x7BDC7BDC); } while(0); + + + + do { clif->cryptKey[0] = (0x116763F2); clif->cryptKey[1] = (0x41117DAC); clif->cryptKey[2] = (0x7FD13C45); } while(0); + + + + do { clif->cryptKey[0] = (0x15D3271C); clif->cryptKey[1] = (0x004D725B); clif->cryptKey[2] = (0x111A3A37); } while(0); + + + + do { clif->cryptKey[0] = (0x04810281); clif->cryptKey[1] = (0x42814281); clif->cryptKey[2] = (0x42814281); } while(0); + + + + do { clif->cryptKey[0] = (0x2DFF467C); clif->cryptKey[1] = (0x444B37EE); clif->cryptKey[2] = (0x2C1B634F); } while(0); + + + + do { clif->cryptKey[0] = (0x290551EA); clif->cryptKey[1] = (0x2B952C75); clif->cryptKey[2] = (0x2D67669B); } while(0); + + + + + + do { clif->cryptKey[0] = (0x62C86D09); clif->cryptKey[1] = (0x75944F17); clif->cryptKey[2] = (0x112C133D); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20150513/src/login.c b/servergreps/hercules/20150513/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20150513/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} diff --git a/servergreps/hercules/20150805/serverpackets.txt b/servergreps/hercules/20150805/serverpackets.txt index 0979e7d..fac208d 100644 --- a/servergreps/hercules/20150805/serverpackets.txt +++ b/servergreps/hercules/20150805/serverpackets.txt @@ -41,7 +41,6 @@ bd client name: SMSG_PLAYER_STAT_UPDATE_5 be client name: SMSG_PLAYER_STAT_UPDATE_6 c0 client name: SMSG_BEING_EMOTION c2 client name: SMSG_WHO_ANSWER -c3 client name: SMSG_BEING_CHANGE_LOOKS_OUTDATED c4 client name: SMSG_NPC_BUY_SELL_CHOICE c6 client name: SMSG_NPC_BUY c7 client name: SMSG_NPC_SELL @@ -60,7 +59,6 @@ dc client name: SMSG_CHAT_ROOM_ADD_MEMBER dd client name: SMSG_CHAT_ROOM_LEAVE df client name: SMSG_CHAT_ROOM_SETTINGS e1 client name: SMSG_CHAT_ROOM_ROLE_CHANGE -e5 client name: SMSG_TRADE_REQUEST e7 client name: SMSG_TRADE_RESPONSE_OUTDATED ea client name: SMSG_TRADE_ITEM_ADD_RESPONSE ec client name: SMSG_TRADE_OK @@ -72,11 +70,7 @@ f6 client name: SMSG_PLAYER_STORAGE_REMOVE f8 client name: SMSG_PLAYER_STORAGE_CLOSE fa client name: SMSG_PARTY_CREATE fb client name: SMSG_PARTY_INFO -fd client name: SMSG_PARTY_INVITE_RESPONSE_OUTDATED -fe client name: SMSG_PARTY_INVITED -101 client name: SMSG_PARTY_SETTINGS 105 client name: SMSG_PARTY_LEAVE -106 client name: SMSG_PLAYER_HP 107 client name: SMSG_PARTY_UPDATE_COORDS 109 client name: SMSG_PARTY_MESSAGE 10a client name: SMSG_MVP_ITEM @@ -87,10 +81,7 @@ fe client name: SMSG_PARTY_INVITED 10f client name: SMSG_PLAYER_SKILLS 110 client name: SMSG_SKILL_FAILED 111 client name: SMSG_PLAYER_ADD_SKILL -114 client name: SMSG_SKILL_DAMAGE -115 client name: SMSG_SKILL_GROUND_DAMAGE_UNUSED 117 client name: SMSG_SKILL_GROUND_NO_DAMAGE -119 client name: SMSG_PLAYER_STATUS_CHANGE 11a client name: SMSG_SKILL_NO_DAMAGE 11c client name: SMSG_SKILL_WARP_POINT 11e client name: SMSG_SKILL_MEMO_MESSAGE @@ -102,7 +93,6 @@ fe client name: SMSG_PARTY_INVITED 12d client name: SMSG_VENDING_OPEN_REQ 131 client name: SMSG_VENDING_SHOW_BOARD 132 client name: SMSG_VENDING_HIDE_BOARD -133 client name: SMSG_VENDING_ITEMS_LIST 135 client name: SMSG_VENDING_BUY_ACK 136 client name: SMSG_VENDING_OPEN 137 client name: SMSG_VENDING_REPORT @@ -111,7 +101,6 @@ fe client name: SMSG_PARTY_INVITED 13b client name: SMSG_PLAYER_ARROW_MESSAGE 13c client name: SMSG_PLAYER_ARROW_EQUIP 13d client name: SMSG_PLAYER_HEAL -13e client name: SMSG_SKILL_CASTING 141 client name: SMSG_PLAYER_STAT_UPDATE_3 142 client name: SMSG_NPC_INT_INPUT 144 client name: SMSG_NPC_VIEWPOINT @@ -145,7 +134,6 @@ fe client name: SMSG_PARTY_INVITED 17f client name: SMSG_GUILD_MESSAGE 181 client name: SMSG_GUILD_OPPOSITION_ACK 184 client name: SMSG_GUILD_DEL_ALLIANCE -185 client name: SMSG_GUILD_ALLIANCE_ADDED_DISABLED 188 client name: SMSG_PLAYER_REFINE 189 client name: SMSG_PLAYER_NOTIFY_MAPINFO 18b client name: SMSG_MAP_QUIT_RESPONSE @@ -191,8 +179,6 @@ fe client name: SMSG_PARTY_INVITED 1de client name: SMSG_SKILL_DAMAGE 1e0 client name: SMSG_ADMIN_GET_LOGIN_ACK 1e1 client name: SMSG_SPIRIT_BALL_SINGLE -1e2 client name: SMSG_MARRIAGE_PROPOSAL_OUTDATED -1e4 client name: SMSG_MARRIAGE_PROCESS_OUTDATED 1e6 client name: SMSG_FAMILY_CALL_PARTNER 1e9 client name: SMSG_PARTY_MEMBER_INFO 1ea client name: SMSG_WEDDING_EFFECT @@ -292,7 +278,6 @@ fe client name: SMSG_PARTY_INVITED 2f0 client name: SMSG_NPC_SHOW_PROGRESS_BAR 2f2 client name: SMSG_NPC_PROGRESS_BAR_ABORT 43d client name: SMSG_PLAYER_SKILL_COOLDOWN -43e client name: SMSG_PLAYER_SKILL_COOLDOWN_LIST 43f client name: SMSG_BEING_STATUS_CHANGE 440 client name: SMSG_BEING_MILLENIUM_SHIELD 441 client name: SMSG_PLAYER_DELETE_SKILL @@ -344,7 +329,6 @@ fe client name: SMSG_PARTY_INVITED 849 client name: SMSG_NPC_CASH_BUY 84b client name: SMSG_ITEM_DROPPED 8b3 client name: SMSG_SCRIPT_MESSAGE -8b9 client name: SMSG_CHAR_PINCODE_STATUS 8c0 client name: SMSG_NPC_CASH_TAB_PRICE_LIST 8c8 client name: SMSG_BEING_ACTION2 8ca client name: SMSG_NPC_CASH_SCHEDULE @@ -356,18 +340,7 @@ fe client name: SMSG_PARTY_INVITED 8d9 client name: SMSG_BATTLE_JOINED 8db client name: SMSG_BATTLE_NOTICE_DELETE 8df client name: SMSG_BATTLE_BEGINS -8e6 client name: SMSG_RECRUIT_REGISTER_ACK -8e8 client name: SMSG_RECRUIT_SEARCH_ACK -8ea client name: SMSG_RECRUIT_DELETE_ACK -8ec client name: SMSG_RECRUIT_INSERT_NOTIFY -8ed client name: SMSG_RECRUIT_UPDATE_NOTIFY -8ee client name: SMSG_RECRUIT_DELETE_NOTIFY -8f2 client name: SMSG_BOOKING_VOLUNTEER_INFO -8fa client name: SMSG_BOOKING_REFUSE_VOLUNTEER 908 client name: SMSG_PLAYER_FAVORITE_ITEM -909 client name: SMSG_BOOKING_CANCEL_VOLUNTEER -90b client name: SMSG_BOOKING_ADD_FILTERING_LIST -90c client name: SMSG_BOOKING_SUB_FILTERING_LIST 96d client name: SMSG_MERGE_ITEM 96f client name: SMSG_ACK_MERGE_ITEMS 977 client name: SMSG_MONSTER_HP @@ -410,22 +383,15 @@ a20 client name: SMSG_ROULETTE_GENERATE_ACK_TYPE a22 client name: SMSG_ROULETTE_RECV_ITEM_ACK a28 client name: SMSG_VENDING_OPEN_STATUS a2d client name: SMSG_BEING_VIEW_EQUIPMENT -2710 2711 -2712 2713 -2714 2716 2717 2718 2719 2722 2723 -2724 -2725 -2727 2728 -272a 272b 272c 272d @@ -435,185 +401,25 @@ a2d client name: SMSG_BEING_VIEW_EQUIPMENT 2735 2736 2737 -2738 -2739 2740 -2741 -2af8 2af9 -2afa 2afb -2afc 2afd -2afe -2aff 2b00 -2b01 -2b02 2b03 2b04 -2b05 2b06 -2b07 -2b08 2b09 -2b0a -2b0b -2b0c 2b0d -2b0e 2b0f -2b10 -2b11 2b12 2b14 -2b16 -2b17 -2b18 -2b19 -2b1a 2b1b -2b1c 2b1d 2b1e -2b1f 2b20 2b21 2b22 -2b23 2b24 2b25 -2b26 2b27 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3039 -303a -303b -303c -303d -303e -303f -3040 -3041 -3048 -3049 -304a -304b -304c -304d -3050 -3051 -3052 -3053 -3055 -3056 -3060 -3061 -3070 -3071 -3072 -3073 -307c -307d -307e -307f -3080 -3081 -3082 -3083 -3090 -3091 -3092 -3093 -3800 -3801 -3802 -3803 -3804 -3806 -3807 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3830 -3831 -3832 -3834 -3835 -3836 -3837 -3839 -383a -383b -383c -383d -383e -383f -3840 -3843 -3848 -3849 -384a -384b -384c -384d -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3860 -3861 -3870 -3871 -3872 -387c -387d -387e -3880 -3881 -3882 -3883 -3890 -3891 -3892 -3893 -3894 -idle_unit2type -spawn_unit2type diff --git a/servergreps/hercules/20150805/src/char.c b/servergreps/hercules/20150805/src/char.c new file mode 100644 index 0000000..793ea73 --- /dev/null +++ b/servergreps/hercules/20150805/src/char.c @@ -0,0 +1,16371 @@ +# 1 "../../../server-code/src/char/char.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/char/char.c" +# 23 "../../../server-code/src/char/char.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/char.h" 1 +# 24 "../../../server-code/src/char/char.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/char/char.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/char/char.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/char/char.h" 2 + +enum E_CHARSERVER_ST { + CHARSERVER_ST_RUNNING = CORE_ST_LAST, + CHARSERVER_ST_SHUTDOWN, + CHARSERVER_ST_LAST +}; + +struct char_session_data { + +# 36 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 36 "../../../server-code/src/char/char.h" + auth; + int account_id, login_id1, login_id2, sex; + int found_char[9]; + time_t unban_time[9]; + char email[40]; + time_t expiration_time; + int group_id; + uint8 char_slots; + uint32 version; + uint8 clienttype; + char pincode[4+1]; + uint32 pincode_seed; + uint16 pincode_try; + uint32 pincode_change; + char new_name[(23 + 1)]; + char birthdate[10+1]; +}; + +struct online_char_data { + int account_id; + int char_id; + int fd; + int waiting_disconnect; + short server; + int pincode_enable; +}; + +struct mmo_map_server { + int fd; + uint32 ip; + uint16 port; + int users; + struct { int _max_; int _len_; uint16 *_data_; } maps; +}; + + + + + +enum inventory_table_type { + TABLE_INVENTORY, + TABLE_CART, + TABLE_STORAGE, + TABLE_GUILD_STORAGE, +}; + +struct char_auth_node { + int account_id; + int char_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + int sex; + time_t expiration_time; + int group_id; + unsigned changing_mapservers : 1; +}; + + + + +struct char_interface { + struct mmo_map_server server[2]; + int login_fd; + int char_fd; + struct DBMap *online_char_db; + struct DBMap *char_db_; + char userid[(23 + 1)]; + char passwd[(23 + 1)]; + char server_name[20]; + uint32 ip; + uint16 port; + int server_type; + int new_display; + + char *CHAR_CONF_NAME; + char *NET_CONF_NAME; + char *SQL_CONF_NAME; + char *INTER_CONF_NAME; + + int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data); + int (*delete_char_sql) (int char_id); + struct DBData (*create_online_char_data) (union DBKey key, va_list args); + void (*set_account_online) (int account_id); + void (*set_account_offline) (int account_id); + void (*set_char_charselect) (int account_id); + void (*set_char_online) (int map_id, int char_id, int account_id); + void (*set_char_offline) (int char_id, int account_id); + int (*db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*db_kickoffline) (union DBKey key, struct DBData *data, va_list ap); + void (*set_login_all_offline) (void); + void (*set_all_offline) (int id); + void (*set_all_offline_sql) (void); + struct DBData (*create_charstatus) (union DBKey key, va_list args); + int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p); + int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch); + int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, +# 134 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 134 "../../../server-code/src/char/char.h" + load_everything); + int (*mmo_char_sql_init) (void); + +# 136 "../../../server-code/src/char/char.h" 3 4 +_Bool +# 136 "../../../server-code/src/char/char.h" + (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); + int (*rename_char_sql) (struct char_session_data *sd, int char_id); + int (*check_char_name) (char * name, char * esc_name); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*divorce_char_sql) (int partner_id1, int partner_id2); + int (*count_users) (void); + int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); + void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); + void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); + int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); + int (*char_married) (int pl1, int pl2); + int (*char_child) (int parent_id, int child_id); + int (*char_family) (int cid1, int cid2, int cid3); + void (*disconnect_player) (int account_id); + void (*authfail_fd) (int fd, int type); + void (*request_account_data) (int account_id); + void (*auth_ok) (int fd, struct char_session_data *sd); + void (*ping_login_server) (int fd); + int (*parse_fromlogin_connection_state) (int fd); + void (*auth_error) (int fd, unsigned char flag); + void (*parse_fromlogin_auth_state) (int fd); + void (*parse_fromlogin_account_data) (int fd); + void (*parse_fromlogin_login_pong) (int fd); + void (*changesex) (int account_id, int sex); + int (*parse_fromlogin_changesex_reply) (int fd); + void (*parse_fromlogin_account_reg2) (int fd); + void (*parse_fromlogin_ban) (int fd); + void (*parse_fromlogin_kick) (int fd); + void (*update_ip) (int fd); + void (*parse_fromlogin_update_ip) (int fd); + void (*parse_fromlogin_accinfo2_failed) (int fd); + void (*parse_fromlogin_accinfo2_ok) (int fd); + int (*parse_fromlogin) (int fd); + int (*request_accreg2) (int account_id, int char_id); + void (*global_accreg_to_login_start) (int account_id, int char_id); + void (*global_accreg_to_login_send) (void); + void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, +# 173 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 173 "../../../server-code/src/char/char.h" + is_string); + void (*read_fame_list) (void); + int (*send_fame_list) (int fd); + void (*update_fame_list) (int type, int index, int fame); + int (*loadName) (int char_id, char* name); + void (*parse_frommap_datasync) (int fd); + void (*parse_frommap_skillid2idx) (int fd); + void (*map_received_ok) (int fd); + void (*send_maps) (int fd, int id, int j); + void (*parse_frommap_map_names) (int fd, int id); + void (*send_scdata) (int fd, int aid, int cid); + void (*parse_frommap_request_scdata) (int fd); + void (*parse_frommap_set_users_count) (int fd, int id); + void (*parse_frommap_set_users) (int fd, int id); + void (*save_character_ack) (int fd, int aid, int cid); + void (*parse_frommap_save_character) (int fd, int id); + void (*select_ack) (int fd, int account_id, uint8 flag); + void (*parse_frommap_char_select_req) (int fd); + void (*change_map_server_ack) (int fd, const uint8 *data, +# 191 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 191 "../../../server-code/src/char/char.h" + ok); + void (*parse_frommap_change_map_server) (int fd); + void (*parse_frommap_remove_friend) (int fd); + void (*char_name_ack) (int fd, int char_id); + void (*parse_frommap_char_name_request) (int fd); + void (*parse_frommap_change_email) (int fd); + void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second); + void (*unban) (int char_id, int *result); + void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result); + int (*changecharsex) (int char_id, int sex); + void (*parse_frommap_change_account) (int fd); + void (*parse_frommap_fame_list) (int fd); + void (*parse_frommap_divorce_char) (int fd); + void (*parse_frommap_ragsrvinfo) (int fd); + void (*parse_frommap_set_char_offline) (int fd); + void (*parse_frommap_set_all_offline) (int fd, int id); + void (*parse_frommap_set_char_online) (int fd, int id); + void (*parse_frommap_build_fame_list) (int fd); + void (*parse_frommap_save_status_change_data) (int fd); + void (*send_pong) (int fd); + void (*parse_frommap_ping) (int fd); + void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd); + void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); + void (*parse_frommap_auth_request) (int fd, int id); + void (*parse_frommap_update_ip) (int fd, int id); + void (*parse_frommap_request_stats_report) (int fd); + void (*parse_frommap_scdata_update) (int fd); + void (*parse_frommap_scdata_delete) (int fd); + int (*parse_frommap) (int fd); + int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port); + int (*mapif_init) (int fd); + uint32 (*lan_subnet_check) (uint32 ip); + void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date); + void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result); + void (*delete2_accept_ack) (int fd, int char_id, uint32 result); + void (*delete2_cancel_ack) (int fd, int char_id, uint32 result); + void (*delete2_req) (int fd, struct char_session_data* sd); + void (*delete2_accept) (int fd, struct char_session_data* sd); + void (*delete2_cancel) (int fd, struct char_session_data* sd); + void (*send_account_id) (int fd, int account_id); + void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd); + void (*send_wait_char_server) (int fd); + int (*search_default_maps_mapserver) (struct mmo_charstatus *cd); + void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl); + void (*creation_failed) (int fd, int result); + void (*creation_ok) (int fd, struct mmo_charstatus *char_dat); + void (*parse_char_create_new_char) (int fd, struct char_session_data* sd); + void (*delete_char_failed) (int fd, int flag); + void (*delete_char_ok) (int fd); + void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd); + void (*parse_char_ping) (int fd); + void (*allow_rename) (int fd, int flag); + void (*parse_char_rename_char) (int fd, struct char_session_data* sd); + void (*parse_char_rename_char2) (int fd, struct char_session_data* sd); + void (*rename_char_ack) (int fd, int flag); + void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd); + void (*captcha_notsupported) (int fd); + void (*parse_char_request_captcha) (int fd); + void (*parse_char_check_captcha) (int fd); + void (*parse_char_delete2_req) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd); + void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd); + void (*login_map_server_ack) (int fd, uint8 flag); + void (*parse_char_login_map_server) (int fd, uint32 ipl); + void (*parse_char_pincode_check) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_window) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_change) (int fd, struct char_session_data* sd); + void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd); + void (*parse_char_request_chars) (int fd, struct char_session_data* sd); + void (*change_character_slot_ack) (int fd, +# 261 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 261 "../../../server-code/src/char/char.h" + ret); + void (*parse_char_move_character) (int fd, struct char_session_data* sd); + int (*parse_char_unknown_packet) (int fd, uint32 ipl); + int (*parse_char) (int fd); + int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data); + int (*send_accounts_tologin_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data); + int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*sql_config_read) (const char* cfgName); + void (*config_dispatch) (char *w1, char *w2); + int (*config_read) (const char* cfgName); +}; + + +extern int char_name_option; +extern char char_name_letters[]; +extern +# 279 "../../../server-code/src/char/char.h" 3 4 + _Bool +# 279 "../../../server-code/src/char/char.h" + char_gm_read; +extern int autosave_interval; +extern int save_log; +extern char db_path[]; +extern char char_db[256]; +extern char scdata_db[256]; +extern char cart_db[256]; +extern char inventory_db[256]; +extern char charlog_db[256]; +extern char storage_db[256]; +extern char interlog_db[256]; +extern char skill_db[256]; +extern char memo_db[256]; +extern char guild_db[256]; +extern char guild_alliance_db[256]; +extern char guild_castle_db[256]; +extern char guild_expulsion_db[256]; +extern char guild_member_db[256]; +extern char guild_position_db[256]; +extern char guild_skill_db[256]; +extern char guild_storage_db[256]; +extern char party_db[256]; +extern char pet_db[256]; +extern char mail_db[256]; +extern char auction_db[256]; +extern char quest_db[256]; +extern char homunculus_db[256]; +extern char skill_homunculus_db[256]; +extern char mercenary_db[256]; +extern char mercenary_owner_db[256]; +extern char ragsrvinfo_db[256]; +extern char elemental_db[256]; +extern char acc_reg_num_db[32]; +extern char acc_reg_str_db[32]; +extern char char_reg_str_db[32]; +extern char char_reg_num_db[32]; + +extern int guild_exp_rate; +extern int log_inter; + +void char_load_defaults(void); +void char_defaults(void); + + +extern struct char_interface *chr; +# 25 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/char/HPMchar.h" 1 +# 28 "../../../server-code/src/char/HPMchar.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/char/HPMchar.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/HPMchar.h" + HPM_char_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/char/HPMchar.h" 3 4 + _Bool +# 32 "../../../server-code/src/char/HPMchar.h" + initialize); + +void HPM_char_plugin_load_sub(struct hplugin *plugin); + +void HPM_char_do_final(void); + +void HPM_char_do_init(void); +# 27 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/geoip.h" 1 +# 29 "../../../server-code/src/char/geoip.h" +struct s_geoip { + unsigned char *cache; + +# 31 "../../../server-code/src/char/geoip.h" 3 4 +_Bool +# 31 "../../../server-code/src/char/geoip.h" + active; +}; + + + + + +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) ( +# 41 "../../../server-code/src/char/geoip.h" 3 4 + _Bool +# 41 "../../../server-code/src/char/geoip.h" + shutdown); + void (*init) (void); +}; + + +void geoip_defaults(void); + + +extern struct geoip_interface *geoip; +# 28 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_auction.h" 1 +# 28 "../../../server-code/src/char/int_auction.h" +struct DBMap; + + + + +struct inter_auction_interface { + struct DBMap *db; + int (*count) (int char_id, +# 35 "../../../server-code/src/char/int_auction.h" 3 4 + _Bool +# 35 "../../../server-code/src/char/int_auction.h" + buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + + +void inter_auction_defaults(void); + + +extern struct inter_auction_interface *inter_auction; +# 29 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_elemental.h" 1 +# 29 "../../../server-code/src/char/int_elemental.h" +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_elemental_defaults(void); + + +extern struct inter_elemental_interface *inter_elemental; +# 30 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_guild.h" 1 +# 27 "../../../server-code/src/char/int_guild.h" +enum { + GS_BASIC = 0x0001, + GS_MEMBER = 0x0002, + GS_POSITION = 0x0004, + GS_ALLIANCE = 0x0008, + GS_EXPULSION = 0x0010, + GS_SKILL = 0x0020, + GS_EMBLEM = 0x0040, + GS_CONNECT = 0x0080, + GS_LEVEL = 0x0100, + GS_MES = 0x0200, + GS_MASK = 0x03FF, + GS_BASIC_MASK = (GS_BASIC | GS_EMBLEM | GS_CONNECT | GS_LEVEL | GS_MES), + GS_REMOVE = 0x8000, +}; + + + + +struct inter_guild_interface { + struct DBMap *guild_db; + struct DBMap *castle_db; + unsigned int exp[50]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + +# 57 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/int_guild.h" + (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (union DBKey key, struct DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (const char *str); + +# 64 "../../../server-code/src/char/int_guild.h" 3 4 +_Bool +# 64 "../../../server-code/src/char/int_guild.h" + (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + + +void inter_guild_defaults(void); + + +extern struct inter_guild_interface *inter_guild; +# 31 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_homun.h" 1 +# 29 "../../../server-code/src/char/int_homun.h" +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_homunculus_defaults(void); + + +extern struct inter_homunculus_interface *inter_homunculus; +# 32 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mail.h" 1 +# 26 "../../../server-code/src/char/int_mail.h" +struct item; +struct mail_data; +struct mail_message; + + + + +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + +# 39 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 39 "../../../server-code/src/char/int_mail.h" + (*loadmessage) (int mail_id, struct mail_message* msg); + +# 40 "../../../server-code/src/char/int_mail.h" 3 4 +_Bool +# 40 "../../../server-code/src/char/int_mail.h" + (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; + + +void inter_mail_defaults(void); + + +extern struct inter_mail_interface *inter_mail; +# 33 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_mercenary.h" 1 +# 26 "../../../server-code/src/char/int_mercenary.h" +struct mmo_charstatus; + + + + +struct inter_mercenary_interface { + +# 32 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 32 "../../../server-code/src/char/int_mercenary.h" + (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + +# 33 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 33 "../../../server-code/src/char/int_mercenary.h" + (*owner_tosql) (int char_id, struct mmo_charstatus *status); + +# 34 "../../../server-code/src/char/int_mercenary.h" 3 4 +_Bool +# 34 "../../../server-code/src/char/int_mercenary.h" + (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + + +void inter_mercenary_defaults(void); + + +extern struct inter_mercenary_interface *inter_mercenary; +# 34 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_party.h" 1 +# 28 "../../../server-code/src/char/int_party.h" +struct DBMap; + + +enum { + PS_CREATE = 0x01, + PS_BASIC = 0x02, + PS_LEADER = 0x04, + PS_ADDMEMBER = 0x08, + PS_DELMEMBER = 0x10, + PS_BREAK = 0x20, +}; + +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; + unsigned char size; +}; + + + + +struct inter_party_interface { + struct party_data *pt; + struct DBMap *db; + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + + +void inter_party_defaults(void); + + +extern struct inter_party_interface *inter_party; +# 35 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_pet.h" 1 +# 26 "../../../server-code/src/char/int_pet.h" +struct s_pet; + + + + +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (const struct s_pet *p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; + + +void inter_pet_defaults(void); + + +extern struct inter_pet_interface *inter_pet; +# 36 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_quest.h" 1 +# 29 "../../../server-code/src/char/int_quest.h" +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + + +void inter_quest_defaults(void); + + +extern struct inter_quest_interface *inter_quest; +# 37 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/int_storage.h" 1 +# 26 "../../../server-code/src/char/int_storage.h" +struct storage_data; +struct guild_storage; + + + + +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; + + +void inter_storage_defaults(void); + + +extern struct inter_storage_interface *inter_storage; +# 38 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/inter.h" 1 +# 30 "../../../server-code/src/char/inter.h" +struct Sql; + + + + +struct inter_interface { + struct Sql *sql_handle; + const char* (*msg_txt) (int msg_number); + +# 38 "../../../server-code/src/char/inter.h" 3 4 +_Bool +# 38 "../../../server-code/src/char/inter.h" + (*msg_config_read) (const char *cfg_name, +# 38 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 38 "../../../server-code/src/char/inter.h" + allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, +# 43 "../../../server-code/src/char/inter.h" 3 4 + _Bool +# 43 "../../../server-code/src/char/inter.h" + is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + + +extern unsigned int party_share_level; + +void inter_defaults(void); + + +extern struct inter_interface *inter; +# 39 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/loginif.h" 1 +# 26 "../../../server-code/src/char/loginif.h" +struct char_session_data; + + + + +struct loginif_interface { + void (*init) (void); + void (*final) (void); + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +}; + + +void loginif_defaults(void); + + +extern struct loginif_interface *loginif; +# 40 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/mapif.h" 1 +# 26 "../../../server-code/src/char/mapif.h" +struct WisData; + + + + +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (const unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + +# 54 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 54 "../../../server-code/src/char/mapif.h" + (*elemental_create) (struct s_elemental *ele); + +# 55 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 55 "../../../server-code/src/char/mapif.h" + (*elemental_save) (const struct s_elemental *ele); + +# 56 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 56 "../../../server-code/src/char/mapif.h" + (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + +# 57 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 57 "../../../server-code/src/char/mapif.h" + (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, +# 103 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 103 "../../../server-code/src/char/mapif.h" + flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); + +# 105 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 105 "../../../server-code/src/char/mapif.h" + (*homunculus_create) (struct s_homunculus *hd); + +# 106 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 106 "../../../server-code/src/char/mapif.h" + (*homunculus_save) (const struct s_homunculus *hd); + +# 107 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 107 "../../../server-code/src/char/mapif.h" + (*homunculus_load) (int homun_id, struct s_homunculus* hd); + +# 108 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 108 "../../../server-code/src/char/mapif.h" + (*homunculus_delete) (int homun_id); + +# 109 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 109 "../../../server-code/src/char/mapif.h" + (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, +# 121 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 121 "../../../server-code/src/char/mapif.h" + failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + +# 128 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 128 "../../../server-code/src/char/mapif.h" + (*mercenary_create) (struct s_mercenary *merc); + +# 129 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 129 "../../../server-code/src/char/mapif.h" + (*mercenary_save) (const struct s_mercenary *merc); + +# 130 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 130 "../../../server-code/src/char/mapif.h" + (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + +# 131 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 131 "../../../server-code/src/char/mapif.h" + (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, const struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + +# 172 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 172 "../../../server-code/src/char/mapif.h" + (*quest_delete) (int char_id, int quest_id); + +# 173 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 173 "../../../server-code/src/char/mapif.h" + (*quest_add) (int char_id, struct quest qd); + +# 174 "../../../server-code/src/char/mapif.h" 3 4 +_Bool +# 174 "../../../server-code/src/char/mapif.h" + (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, +# 175 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 175 "../../../server-code/src/char/mapif.h" + success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) ( +# 187 "../../../server-code/src/char/mapif.h" 3 4 + _Bool +# 187 "../../../server-code/src/char/mapif.h" + success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, const unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +}; + + +void mapif_defaults(void); + + +extern struct mapif_interface *mapif; +# 41 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/char/pincode.h" 1 +# 26 "../../../server-code/src/char/pincode.h" +struct char_session_data; + +enum PincodeResponseCode { + PINCODE_OK = 0, + PINCODE_ASK = 1, + PINCODE_NOTSET = 2, + PINCODE_EXPIRED = 3, + PINCODE_UNUSED = 7, + PINCODE_WRONG = 8, +}; + + + + +struct pincode_interface { + + int enabled; + int changetime; + int maxtry; + int charselect; + unsigned int multiplier; + unsigned int baseSeed; + + void (*handle) (int fd, struct char_session_data* sd); + void (*decrypt) (unsigned int userSeed, char* pin); + void (*error) (int account_id); + void (*update) (int account_id, char* pin); + void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + void (*setnew) (int fd, struct char_session_data* sd); + void (*change) (int fd, struct char_session_data* sd); + int (*compare) (int fd, struct char_session_data* sd, char* pin); + void (*check) (int fd, struct char_session_data* sd); + +# 58 "../../../server-code/src/char/pincode.h" 3 4 +_Bool +# 58 "../../../server-code/src/char/pincode.h" + (*config_read) (char *w1, char *w2); +}; + + +void pincode_defaults(void); + + +extern struct pincode_interface *pincode; +# 42 "../../../server-code/src/char/char.c" 2 + + + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 49 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 28 "../../../server-code/src/common/mapindex.h" +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 50 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 52 "../../../server-code/src/char/char.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 54 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 55 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/sql.h" 1 +# 40 "../../../server-code/src/common/sql.h" +enum SqlDataType { + SQLDT_NULL, + + SQLDT_INT8, + SQLDT_INT16, + SQLDT_INT32, + SQLDT_INT64, + SQLDT_UINT8, + SQLDT_UINT16, + SQLDT_UINT32, + SQLDT_UINT64, + + SQLDT_CHAR, + SQLDT_SHORT, + SQLDT_INT, + SQLDT_LONG, + SQLDT_LONGLONG, + SQLDT_UCHAR, + SQLDT_USHORT, + SQLDT_UINT, + SQLDT_ULONG, + SQLDT_ULONGLONG, + + SQLDT_FLOAT, + SQLDT_DOUBLE, + + SQLDT_STRING, + SQLDT_ENUM, + + + SQLDT_BLOB, + SQLDT_LASTID +}; + +struct Sql; +struct SqlStmt; + +struct sql_interface { + + + + int (*Connect) (struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db); + + + + int (*GetTimeout) (struct Sql *self, uint32 *out_timeout); + + + + int (*GetColumnNames) (struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep); + + + + int (*SetEncoding) (struct Sql *self, const char *encoding); + + + + int (*Ping) (struct Sql *self); + + + + + size_t (*EscapeString) (struct Sql *self, char *out_to, const char *from); + + + + + size_t (*EscapeStringLen) (struct Sql *self, char *out_to, const char *from, size_t from_len); + + + + + + int (*Query) (struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + int (*QueryV) (struct Sql *self, const char *query, va_list args); + + + + + + int (*QueryStr) (struct Sql *self, const char *query); + + + + uint64 (*LastInsertId) (struct Sql *self); + + + + uint32 (*NumColumns) (struct Sql *self); + + + + uint64 (*NumRows) (struct Sql *self); + + + + + int (*NextRow) (struct Sql *self); + + + + + int (*GetData) (struct Sql *self, size_t col, char **out_buf, size_t *out_len); + + void (*FreeResult) (struct Sql *self); + + void (*ShowDebug_) (struct Sql *self, const char *debug_file, const unsigned long debug_line); + + void (*Free) (struct Sql *self); + + struct Sql *(*Malloc) (void); +# 179 "../../../server-code/src/common/sql.h" + struct SqlStmt* (*StmtMalloc)(struct Sql *sql); + + + + + + + int (*StmtPrepare) (struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); + + + + + + + int (*StmtPrepareV)(struct SqlStmt *self, const char *query, va_list args); + + + + + + + int (*StmtPrepareStr)(struct SqlStmt *self, const char *query); + + + + + size_t (*StmtNumParams)(struct SqlStmt *self); + + + + + + + int (*StmtBindParam)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len); + + + + + + int (*StmtExecute)(struct SqlStmt *self); + + + + + uint64 (*StmtLastInsertId)(struct SqlStmt *self); + + + + + size_t (*StmtNumColumns)(struct SqlStmt *self); + + + + + + + + int (*StmtBindColumn)(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null); + + + + + uint64 (*StmtNumRows)(struct SqlStmt *self); + + + + + + int (*StmtNextRow)(struct SqlStmt *self); + + + void (*StmtFreeResult)(struct SqlStmt *self); + + + void (*StmtFree)(struct SqlStmt *self); + + void (*StmtShowDebug_)(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line); + +}; + + +void sql_defaults(void); + +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(struct Sql *self); +void Sql_HerculesUpdateSkip(struct Sql *self, const char *filename); + + +extern struct sql_interface *SQL; +# 56 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 57 "../../../server-code/src/char/char.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 58 "../../../server-code/src/char/char.c" 2 + +# 1 "/usr/include/signal.h" 1 3 4 +# 30 "/usr/include/signal.h" 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 + +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 102 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +extern int __sigismember (const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); +# 33 "/usr/include/signal.h" 2 3 4 + + + + + + + +typedef __sig_atomic_t sig_atomic_t; + + + + + + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/signum.h" 1 3 4 +# 58 "/usr/include/signal.h" 2 3 4 +# 80 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 2 3 4 + + + + + + + +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +# 58 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef __clock_t __sigchld_clock_t; + + + +typedef struct + { + int si_signo; + int si_errno; + + int si_code; + + union + { + int _pad[((128 / sizeof (int)) - 4)]; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + } _kill; + + + struct + { + int si_tid; + int si_overrun; + sigval_t si_sigval; + } _timer; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; + } _rt; + + + struct + { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __sigchld_clock_t si_utime; + __sigchld_clock_t si_stime; + } _sigchld; + + + struct + { + void *si_addr; + short int si_addr_lsb; + struct + { + void *_lower; + void *_upper; + } si_addr_bnd; + } _sigfault; + + + struct + { + long int si_band; + int si_fd; + } _sigpoll; + + + struct + { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; + } siginfo_t ; +# 160 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + SI_ASYNCNL = -60, + + SI_TKILL = -6, + + SI_SIGIO, + + SI_ASYNCIO, + + SI_MESGQ, + + SI_TIMER, + + SI_QUEUE, + + SI_USER, + + SI_KERNEL = 0x80 + +}; + + + + +enum +{ + ILL_ILLOPC = 1, + + ILL_ILLOPN, + + ILL_ILLADR, + + ILL_ILLTRP, + + ILL_PRVOPC, + + ILL_PRVREG, + + ILL_COPROC, + + ILL_BADSTK + +}; + + +enum +{ + FPE_INTDIV = 1, + + FPE_INTOVF, + + FPE_FLTDIV, + + FPE_FLTOVF, + + FPE_FLTUND, + + FPE_FLTRES, + + FPE_FLTINV, + + FPE_FLTSUB + +}; + + +enum +{ + SEGV_MAPERR = 1, + + SEGV_ACCERR + +}; + + +enum +{ + BUS_ADRALN = 1, + + BUS_ADRERR, + + BUS_OBJERR, + + BUS_MCEERR_AR, + + BUS_MCEERR_AO + +}; +# 264 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +enum +{ + CLD_EXITED = 1, + + CLD_KILLED, + + CLD_DUMPED, + + CLD_TRAPPED, + + CLD_STOPPED, + + CLD_CONTINUED + +}; + + +enum +{ + POLL_IN = 1, + + POLL_OUT, + + POLL_MSG, + + POLL_ERR, + + POLL_PRI, + + POLL_HUP + +}; +# 316 "/usr/include/x86_64-linux-gnu/bits/siginfo.h" 3 4 +typedef union pthread_attr_t pthread_attr_t; + + + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[((64 / sizeof (int)) - 4)]; + + + + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); + pthread_attr_t *_attribute; + } _sigev_thread; + } _sigev_un; + } sigevent_t; + + + + + + +enum +{ + SIGEV_SIGNAL = 0, + + SIGEV_NONE, + + SIGEV_THREAD, + + + SIGEV_THREAD_ID = 4 + +}; +# 81 "/usr/include/signal.h" 2 3 4 + + + + +typedef void (*__sighandler_t) (int); + + + + +extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 100 "/usr/include/signal.h" 3 4 + + +extern __sighandler_t signal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +# 114 "/usr/include/signal.h" 3 4 + +# 127 "/usr/include/signal.h" 3 4 +extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) + __attribute__ ((__nothrow__ , __leaf__)); +extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void psignal (int __sig, const char *__s); + + +extern void psiginfo (const siginfo_t *__pinfo, const char *__s); +# 187 "/usr/include/signal.h" 3 4 +extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + +extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); +# 207 "/usr/include/signal.h" 3 4 +typedef __sighandler_t sig_t; + + + + + +extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int sigismember (const sigset_t *__set, int __signo) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 243 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/sigaction.h" 3 4 +struct sigaction + { + + + union + { + + __sighandler_t sa_handler; + + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; + + + + + + + + __sigset_t sa_mask; + + + int sa_flags; + + + void (*sa_restorer) (void); + }; +# 244 "/usr/include/signal.h" 2 3 4 + + +extern int sigprocmask (int __how, const sigset_t *__restrict __set, + sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1))); + + +extern int sigaction (int __sig, const struct sigaction *__restrict __act, + struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig) + __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int sigwaitinfo (const sigset_t *__restrict __set, + siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sigtimedwait (const sigset_t *__restrict __set, + siginfo_t *__restrict __info, + const struct timespec *__restrict __timeout) + __attribute__ ((__nonnull__ (1))); + + + +extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val) + __attribute__ ((__nothrow__ , __leaf__)); +# 301 "/usr/include/signal.h" 3 4 +extern const char *const _sys_siglist[65]; +extern const char *const sys_siglist[65]; + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t padding[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short padding[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; +# 121 "/usr/include/x86_64-linux-gnu/bits/sigcontext.h" 3 4 +struct _fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + + + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t reserved1[2]; + __uint64_t reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; +# 307 "/usr/include/signal.h" 2 3 4 + + +extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 317 "/usr/include/signal.h" 2 3 4 + + + + +extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__)); + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 1 3 4 +# 25 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +struct sigstack + { + void *ss_sp; + int ss_onstack; + }; + + + +enum +{ + SS_ONSTACK = 1, + + SS_DISABLE + +}; +# 49 "/usr/include/x86_64-linux-gnu/bits/sigstack.h" 3 4 +typedef struct sigaltstack + { + void *ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; +# 324 "/usr/include/signal.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +# 1 "/usr/include/signal.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +__extension__ typedef long long int greg_t; + + + + + +typedef greg_t gregset_t[23]; +# 92 "/usr/include/x86_64-linux-gnu/sys/ucontext.h" 3 4 +struct _libc_fpxreg +{ + unsigned short int significand[4]; + unsigned short int exponent; + unsigned short int padding[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t element[4]; +}; + +struct _libc_fpstate +{ + + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t padding[24]; +}; + + +typedef struct _libc_fpstate *fpregset_t; + + +typedef struct + { + gregset_t gregs; + + fpregset_t fpregs; + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + + +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + } ucontext_t; +# 327 "/usr/include/signal.h" 2 3 4 + + + + + +extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__)); + + + +extern int sigaltstack (const struct sigaltstack *__restrict __ss, + struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__)); +# 361 "/usr/include/signal.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + + + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 362 "/usr/include/signal.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/sigthread.h" 3 4 +extern int pthread_sigmask (int __how, + const __sigset_t *__restrict __newmask, + __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__)); + + +extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__)); +# 363 "/usr/include/signal.h" 2 3 4 + + + + + + +extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +# 60 "../../../server-code/src/char/char.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 +# 45 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 273 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 63 "../../../server-code/src/char/char.c" 2 + + + + +# 66 "../../../server-code/src/char/char.c" +char char_db[256] = "char"; +char scdata_db[256] = "sc_data"; +char cart_db[256] = "cart_inventory"; +char inventory_db[256] = "inventory"; +char charlog_db[256] = "charlog"; +char storage_db[256] = "storage"; +char interlog_db[256] = "interlog"; +char skill_db[256] = "skill"; +char memo_db[256] = "memo"; +char guild_db[256] = "guild"; +char guild_alliance_db[256] = "guild_alliance"; +char guild_castle_db[256] = "guild_castle"; +char guild_expulsion_db[256] = "guild_expulsion"; +char guild_member_db[256] = "guild_member"; +char guild_position_db[256] = "guild_position"; +char guild_skill_db[256] = "guild_skill"; +char guild_storage_db[256] = "guild_storage"; +char party_db[256] = "party"; +char pet_db[256] = "pet"; +char mail_db[256] = "mail"; +char auction_db[256] = "auction"; +char friend_db[256] = "friends"; +char hotkey_db[256] = "hotkey"; +char quest_db[256] = "quest"; +char homunculus_db[256] = "homunculus"; +char skill_homunculus_db[256] = "skill_homunculus"; +char mercenary_db[256] = "mercenary"; +char mercenary_owner_db[256] = "mercenary_owner"; +char ragsrvinfo_db[256] = "ragsrvinfo"; +char elemental_db[256] = "elemental"; +char account_data_db[256] = "account_data"; +char acc_reg_num_db[32] = "acc_reg_num_db"; +char acc_reg_str_db[32] = "acc_reg_str_db"; +char char_reg_str_db[32] = "char_reg_str_db"; +char char_reg_num_db[32] = "char_reg_num_db"; + +struct char_interface char_s; +struct char_interface *chr; + + +int save_log = 1; + +char db_path[1024] = "db"; + +char wisp_server_name[(23 + 1)] = "Server"; +char login_ip_str[128]; +uint32 login_ip = 0; +uint16 login_port = 6900; +char char_ip_str[128]; +char bind_ip_str[128]; +uint32 bind_ip = INADDR_ANY; +int char_maintenance_min_group_id = 0; + +# 118 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 118 "../../../server-code/src/char/char.c" + char_new = +# 118 "../../../server-code/src/char/char.c" 3 4 + 1 +# 118 "../../../server-code/src/char/char.c" + ; + + +# 120 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 120 "../../../server-code/src/char/char.c" + name_ignoring_case = +# 120 "../../../server-code/src/char/char.c" 3 4 + 0 +# 120 "../../../server-code/src/char/char.c" + ; +int char_name_option = 0; +char unknown_char_name[(23 + 1)] = "Unknown"; + +char char_name_letters[1024] = ""; + +int char_del_level = 0; +int char_del_delay = 86400; + +int log_char = 1; +int log_inter = 1; + +int char_aegis_delete = 0; + +int max_connect_user = -1; +int gm_allow_group = -1; +int autosave_interval = (300*1000); +int start_zeny = 0; +int start_items[32*3]; +int guild_exp_rate = 100; + + +int fame_list_size_chemist = 10; +int fame_list_size_smith = 10; +int fame_list_size_taekwon = 10; + + +struct fame_list smith_fame_list[10]; +struct fame_list chemist_fame_list[10]; +struct fame_list taekwon_fame_list[10]; + + + + struct point start_point = { 0, 97, 90 }; + + + + +unsigned short skillid2idx[10015]; + + + + + + +static struct DBMap *auth_db; +# 174 "../../../server-code/src/char/char.c" +static struct DBData char_create_online_char_data(union DBKey key, va_list args) +{ + struct online_char_data* character; + ((character) = (struct online_char_data *) (iMalloc->calloc(((1)),(sizeof(struct online_char_data)),"../../../server-code/src/char/char.c", 177, __func__))); + character->account_id = key.i; + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + character->fd = -1; + character->waiting_disconnect = (-1); + return DB->ptr2data(character); +} + +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) +{ + struct online_char_data* character; + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + character->char_id = -1; + character->server = -1; + if(character->pincode_enable == -1) + character->pincode_enable = pincode->charselect + pincode->enabled; + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_online(int map_id, int char_id, int account_id) +{ + struct online_char_data* character; + struct mmo_charstatus *cp; + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 234)); + + + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(account_id),(chr->create_online_char_data))) ); + if( character->char_id != -1 && character->server > -1 && character->server != map_id ) + { + (showmsg->showNotice(("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, map_id, account_id, char_id)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + + + character->char_id = char_id; + character->server = map_id; + + if( character->server > -1 ) + chr->server[character->server].users++; + + + if(character->waiting_disconnect != (-1)) { + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + + cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); +} + +void char_set_char_offline(int char_id, int account_id) +{ + struct online_char_data* character; + + if ( char_id == -1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 274)); + } + else + { + struct mmo_charstatus* cp = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); + if (cp) + ( (chr->char_db_)->remove((chr->char_db_),DB->i2key(char_id), +# 281 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 281 "../../../server-code/src/char/char.c" + ) ); + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 284)); + } + + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(account_id))) )) != +# 287 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 287 "../../../server-code/src/char/char.c" + ) { + + if( character->server > -1 ) + if( chr->server[character->server].users > 0 ) + chr->server[character->server].users--; + + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + + if(character->char_id == char_id) + { + character->char_id = -1; + character->server = -1; + character->pincode_enable = -1; + } + + + } + + + if (chr->login_fd > 0 && !sockt->session[chr->login_fd]->flag.eof && (char_id == -1 || character == +# 309 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 309 "../../../server-code/src/char/char.c" + || character->fd == -1)) + chr->set_account_offline(account_id); +} + + + + +static int char_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 319 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 319 "../../../server-code/src/char/char.c" + ap +# 319 "../../../server-code/src/char/char.c" 3 4 + , +# 319 "../../../server-code/src/char/char.c" + int +# 319 "../../../server-code/src/char/char.c" 3 4 + ) +# 319 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 320 "../../../server-code/src/char/char.c" 3 4 +0 +# 320 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (server_id == -1) { + character->char_id = -1; + character->server = -1; + if(character->waiting_disconnect != (-1)){ + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); + character->waiting_disconnect = (-1); + } + } else if (character->server == server_id) + character->server = -2; + return 0; +} + + + + +static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data); + int server_id = +# 339 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 339 "../../../server-code/src/char/char.c" + ap +# 339 "../../../server-code/src/char/char.c" 3 4 + , +# 339 "../../../server-code/src/char/char.c" + int +# 339 "../../../server-code/src/char/char.c" 3 4 + ) +# 339 "../../../server-code/src/char/char.c" + ; + do { if (((void)(character), +# 340 "../../../server-code/src/char/char.c" 3 4 +0 +# 340 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + if (server_id > -1 && character->server != server_id) + return 0; + + + if (character->server > -1 && character->server < 2) + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 1); + else if (character->waiting_disconnect == (-1)) + chr->set_char_offline(character->char_id, character->account_id); + else + return 0; + + return 1; +} + +void char_set_login_all_offline(void) +{ + + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) +{ + if (id < 0) + (showmsg->showNotice(("Sending all users offline.\n"))); + else + (showmsg->showNotice(("Sending users of map-server %d offline.\n"),id)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); + + if (id >= 0 || chr->login_fd <= 0 || sockt->session[chr->login_fd]->flag.eof) + return; + chr->set_login_all_offline(); +} + +void char_set_all_offline_sql(void) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 381)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 383)); + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 385)); +} + + + + +static struct DBData char_create_charstatus(union DBKey key, va_list args) +{ + struct mmo_charstatus *cp; + cp = (struct mmo_charstatus *) (iMalloc->calloc((1),(sizeof(struct mmo_charstatus)),"../../../server-code/src/char/char.c", 394, __func__)); + cp->char_id = key.i; + return DB->ptr2data(cp); +} + +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +{ + int i = 0; + int count = 0; + int diff = 0; + char save_status[128]; + struct mmo_charstatus *cp; + int errors = 0; + StringBuf buf; + + do { if (((void)(p), +# 409 "../../../server-code/src/char/char.c" 3 4 +0 +# 409 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (char_id != p->char_id) return 0; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + + StrBuf->Init(&buf); + memset(save_status, 0, sizeof(save_status)); + + + if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { + if (!chr->memitemdata_to_sql(p->inventory, 100, p->char_id, TABLE_INVENTORY)) + strcat(save_status, " inventory"); + else + errors++; + } + + + if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { + if (!chr->memitemdata_to_sql(p->cart, 100, p->char_id, TABLE_CART)) + strcat(save_status, " cart"); + else + errors++; + } + + + if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { + if (!chr->memitemdata_to_sql(p->storage.items, 600, p->account_id, TABLE_STORAGE)) + strcat(save_status, " storage"); + else + errors++; + } + + if ( + (p->base_exp != cp->base_exp) || (p->base_level != cp->base_level) || + (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || + (p->zeny != cp->zeny) || + (p->last_point.map != cp->last_point.map) || + (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || + (p->max_hp != cp->max_hp) || (p->hp != cp->hp) || + (p->max_sp != cp->max_sp) || (p->sp != cp->sp) || + (p->status_point != cp->status_point) || (p->skill_point != cp->skill_point) || + (p->str != cp->str) || (p->agi != cp->agi) || (p->vit != cp->vit) || + (p->int_ != cp->int_) || (p->dex != cp->dex) || (p->luk != cp->luk) || + (p->option != cp->option) || + (p->party_id != cp->party_id) || (p->guild_id != cp->guild_id) || + (p->pet_id != cp->pet_id) || (p->weapon != cp->weapon) || (p->hom_id != cp->hom_id) || + (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || + (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || + (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->robe != cp->robe) || + (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) + ) { + + unsigned int opt = 0; + + if( p->allow_party ) + opt |= OPT_ALLOW_PARTY; + if( p->show_equip ) + opt |= OPT_SHOW_EQUIP; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u'," + "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," + "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u'," + "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," + "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," + "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," + "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," + "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," + "`hotkey_rowshift`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->base_level, p->job_level, + p->base_exp, p->job_exp, p->zeny, + p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, + p->str, p->agi, p->vit, p->int_, p->dex, p->luk, + p->option, p->party_id, p->guild_id, p->pet_id, p->hom_id, p->ele_id, + p->weapon, p->shield, p->head_top, p->head_mid, p->head_bottom, + mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 485, __func__), p->last_point.x, p->last_point.y, + mapindex->id2name((p->save_point.map),"../../../server-code/src/char/char.c", 486, __func__), p->save_point.x, p->save_point.y, p->rename, + (unsigned long)p->delete_date, + p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, + p->hotkey_rowshift, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 492)); + errors++; + } else + strcat(save_status, " status"); + } + + if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { + if( (-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 500)); + errors++; + } else + strcat(save_status, " accdata"); + } + + + if ( + (p->hair != cp->hair) || (p->hair_color != cp->hair_color) || + (p->clothes_color != cp->clothes_color) || (p->body != cp->body) || + (p->class_ != cp->class_) || + (p->partner_id != cp->partner_id) || (p->father != cp->father) || + (p->mother != cp->mother) || (p->child != cp->child) || + (p->karma != cp->karma) || (p->manner != cp->manner) || + (p->fame != cp->fame) + ) + { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," + "`hair`='%d', `hair_color`='%d', `clothes_color`='%d', `body`='%d'," + "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," + "`karma`='%d', `manner`='%d', `fame`='%d'" + " WHERE `account_id`='%d' AND `char_id` = '%d'", + char_db, p->class_, + p->hair, p->hair_color, p->clothes_color, p->body, + p->partner_id, p->father, p->mother, p->child, + p->karma, p->manner, p->fame, + p->account_id, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 528)); + errors++; + } else + strcat(save_status, " status2"); + } + + + if( (p->mer_id != cp->mer_id) || + (p->arch_calls != cp->arch_calls) || (p->arch_faith != cp->arch_faith) || + (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || + (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) + { + if (inter_mercenary->owner_tosql(char_id, p)) + strcat(save_status, " mercenary"); + else + errors++; + } + + + if( memcmp(p->memo_point, cp->memo_point, sizeof(p->memo_point)) ) + { + char esc_mapname[(23 + 1)*2+1]; + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 554)); + errors++; + } + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`map`,`x`,`y`) VALUES ", memo_db); + for( i = 0, count = 0; i < 3; ++i ) + { + if( p->memo_point[i].map ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex->id2name((p->memo_point[i].map),"../../../server-code/src/char/char.c", 567, __func__)); + StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 576)); + errors++; + } + } + strcat(save_status, " memo"); + } + + + if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 587)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); + + for( i = 0, count = 0; i < 1478; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) + continue; + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + continue; + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0); + ++count; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 612)); + errors++; + } + } + + strcat(save_status, " skills"); + } + + diff = 0; + for(i = 0; i < 40; i++){ + if(p->friends[i].char_id != cp->friends[i].char_id || + p->friends[i].account_id != cp->friends[i].account_id){ + diff = 1; + break; + } + } + + if(diff == 1) { + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 633)); + errors++; + } + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `friend_account`, `friend_id`) VALUES ", friend_db); + for( i = 0, count = 0; i < 40; ++i ) + { + if( p->friends[i].char_id > 0 ) + { + if( count ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%d','%d')", char_id, p->friends[i].account_id, p->friends[i].char_id); + count++; + } + } + if( count ) + { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 653)); + errors++; + } + } + strcat(save_status, " friends"); + } + + + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "REPLACE INTO `%s` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`) VALUES ", hotkey_db); + diff = 0; + for(i = 0; i < ( (int)(sizeof(p->hotkeys)/sizeof((p->hotkeys)[0])) ); i++){ + if(memcmp(&p->hotkeys[i], &cp->hotkeys[i], sizeof(struct hotkey))) + { + if( diff ) + StrBuf->AppendStr(&buf, ","); + StrBuf->Printf(&buf, "('%d','%u','%u','%u','%u')", char_id, (unsigned int)i, (unsigned int)p->hotkeys[i].type, p->hotkeys[i].id , (unsigned int)p->hotkeys[i].lv); + diff = 1; + } + } + if(diff) { + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 677)); + errors++; + } else + strcat(save_status, " hotkeys"); + } + + + StrBuf->Destroy(&buf); + if (save_status[0]!='\0' && save_log) + (showmsg->showInfo(("Saved char %d - %s:%s.\n"), char_id, p->name, save_status)); + if (!errors) + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 0; +} +# 702 "../../../server-code/src/char/char.c" +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +{ + StringBuf buf; + struct SqlStmt *stmt = +# 705 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 705 "../../../server-code/src/char/char.c" + ; + int i, j; + const char *tablename = +# 707 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 707 "../../../server-code/src/char/char.c" + ; + const char *selectoption = +# 708 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 708 "../../../server-code/src/char/char.c" + ; + +# 709 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 709 "../../../server-code/src/char/char.c" + has_favorite = +# 709 "../../../server-code/src/char/char.c" 3 4 + 0 +# 709 "../../../server-code/src/char/char.c" + ; + struct item item = { 0 }; + +# 711 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 711 "../../../server-code/src/char/char.c" + *flag = +# 711 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 711 "../../../server-code/src/char/char.c" + ; + +# 712 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 712 "../../../server-code/src/char/char.c" + found; + int errors = 0; + + do { if (((void)(items), +# 715 "../../../server-code/src/char/char.c" 3 4 +0 +# 715 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + switch (tableswitch) { + case TABLE_INVENTORY: tablename = inventory_db; selectoption = "char_id"; has_favorite = +# 718 "../../../server-code/src/char/char.c" 3 4 + 1 +# 718 "../../../server-code/src/char/char.c" + ; break; + case TABLE_CART: tablename = cart_db; selectoption = "char_id"; break; + case TABLE_STORAGE: tablename = storage_db; selectoption = "account_id"; break; + case TABLE_GUILD_STORAGE: tablename = guild_storage_db; selectoption = "guild_id"; break; + default: + (showmsg->showError(("Invalid table name!\n"))); + do { if (( (tableswitch) ? +# 724 "../../../server-code/src/char/char.c" 3 4 + 0 +# 724 "../../../server-code/src/char/char.c" + : (nullpo->assert_report("../../../server-code/src/char/char.c", 724, __func__, "tableswitch", "failed assertion"), +# 724 "../../../server-code/src/char/char.c" 3 4 + 1 +# 724 "../../../server-code/src/char/char.c" + ) )) return(1); } while(0); + } + + + + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtExecute(stmt)) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 743)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + return 1; + } + + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + , +# 749 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 749 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + , +# 750 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 750 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + , +# 751 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 751 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + , +# 752 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 752 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + , +# 753 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 753 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + , +# 754 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 754 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + , +# 755 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 755 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + , +# 756 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 756 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + , +# 757 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 757 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + , +# 758 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 758 "../../../server-code/src/char/char.c" + ); + for (j = 0; j < 4; ++j) + SQL->StmtBindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + , +# 760 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 760 "../../../server-code/src/char/char.c" + ); + if (has_favorite) + SQL->StmtBindColumn(stmt, 10+4, SQLDT_UCHAR, &item.favorite, 0, +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + , +# 762 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 762 "../../../server-code/src/char/char.c" + ); + + + flag = (iMalloc->calloc((max),(sizeof( +# 765 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 765 "../../../server-code/src/char/char.c" + )),"../../../server-code/src/char/char.c", 765, __func__)); + + while (0 == SQL->StmtNextRow(stmt)) { + found = +# 768 "../../../server-code/src/char/char.c" 3 4 + 0 +# 768 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (items[i].nameid == item.nameid + && items[i].unique_id == item.unique_id + && items[i].card[0] == item.card[0] + && items[i].card[2] == item.card[2] + && items[i].card[3] == item.card[3] + ) { + + do { for ((j) = (0); (j) < (4); ++(j)) if (items[i].card[j] != item.card[j]) break; } while( +# 782 "../../../server-code/src/char/char.c" 3 4 + 0 +# 782 "../../../server-code/src/char/char.c" + ); + if (j == 4 + && items[i].amount == item.amount + && items[i].equip == item.equip + && items[i].identify == item.identify + && items[i].refine == item.refine + && items[i].attribute == item.attribute + && items[i].expire_time == item.expire_time + && items[i].bound == item.bound + && (!has_favorite || items[i].favorite == item.favorite) + ) { + ; + } else { + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'", + tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", `favorite`='%d'", items[i].favorite); + StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); + + if ((-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 806)); + errors++; + } + } + + found = flag[i] = +# 811 "../../../server-code/src/char/char.c" 3 4 + 1 +# 811 "../../../server-code/src/char/char.c" + ; + break; + } + } + if (!found) { + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 818)); + errors++; + } + } + } + SQL->StmtFree(stmt); + + StrBuf->Clear(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", `card%d`", j); + if (has_favorite) + StrBuf->AppendStr(&buf, ", `favorite`"); + StrBuf->AppendStr(&buf, ") VALUES "); + + found = +# 833 "../../../server-code/src/char/char.c" 3 4 + 0 +# 833 "../../../server-code/src/char/char.c" + ; + + for (i = 0; i < max; ++i) { + + if (items[i].nameid == 0 || flag[i]) + continue; + + if (found) + StrBuf->AppendStr(&buf, ","); + else + found = +# 843 "../../../server-code/src/char/char.c" 3 4 + 1 +# 843 "../../../server-code/src/char/char.c" + ; + + StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" +# 845 "../../../server-code/src/char/char.c" 3 4 + "l" "u" +# 845 "../../../server-code/src/char/char.c" + "'", + id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id); + for (j = 0; j < 4; ++j) + StrBuf->Printf(&buf, ", '%d'", items[i].card[j]); + if (has_favorite) + StrBuf->Printf(&buf, ", '%d'", items[i].favorite); + StrBuf->AppendStr(&buf, ")"); + } + + if (found && (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf))) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 855)); + errors++; + } + + StrBuf->Destroy(&buf); + (iMalloc->free((flag),"../../../server-code/src/char/char.c", 860, __func__)); + + return errors; +} +# 878 "../../../server-code/src/char/char.c" +int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +{ + + (void)sd; (void)p; + switch (sex) { + case 'M': + return SEX_MALE; + case 'F': + return SEX_FEMALE; + case 'U': + default: + return 99; + } +# 912 "../../../server-code/src/char/char.c" +} + + + +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +{ + struct SqlStmt *stmt; + struct mmo_charstatus p; + int j = 0, i; + char last_map[((11 + 1) + 4)]; + time_t unban_time = 0; + char sex[2]; + + do { if (((void)(sd), +# 925 "../../../server-code/src/char/char.c" 3 4 +0 +# 925 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + do { if (((void)(buf), +# 926 "../../../server-code/src/char/char.c" 3 4 +0 +# 926 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 929 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 929 "../../../server-code/src/char/char.c" + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 930)); + return 0; + } + memset(&p, 0, sizeof(p)); + + for(i = 0 ; i < 9; i++ ) { + sd->found_char[i] = -1; + sd->unban_time[i] = 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," + "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," + "`robe`,`slotchange`,`unban_time`,`sex`" + " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, 9) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + , +# 949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 949 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + , +# 950 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 950 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + , +# 951 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 951 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + , +# 952 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 952 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + , +# 953 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 953 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + , +# 954 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 954 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + , +# 955 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 955 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + , +# 956 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 956 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + , +# 957 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 957 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + , +# 958 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 958 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + , +# 959 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 959 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + , +# 960 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 960 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + , +# 961 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 961 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + , +# 962 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 962 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + , +# 963 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 963 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + , +# 964 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 964 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + , +# 965 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 965 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + , +# 966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 966 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + , +# 967 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 967 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + , +# 968 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 968 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + , +# 969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 969 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + , +# 970 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 970 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + , +# 971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 971 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + , +# 972 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 972 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + , +# 973 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 973 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + , +# 974 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 974 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + , +# 975 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 975 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + , +# 976 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 976 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + , +# 977 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 977 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + , +# 978 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 978 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + , +# 979 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 979 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + , +# 980 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 980 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + , +# 981 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 981 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof(last_map), +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + , +# 982 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 982 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, 0, +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + , +# 983 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 983 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + , +# 984 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 984 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + , +# 985 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 985 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + , +# 986 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 986 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + , +# 987 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 987 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + , +# 988 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 988 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 990)); + SQL->StmtFree(stmt); + return 0; + } + + for( i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); i++ ) { + if (p.slot >= 9) + continue; + p.last_point.map = mapindex->name2id(last_map); + sd->found_char[p.slot] = p.char_id; + sd->unban_time[p.slot] = unban_time; + p.sex = chr->mmo_gender(sd, &p, sex[0]); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + } + + memset(sd->new_name,0,sizeof(sd->new_name)); + + SQL->StmtFree(stmt); + return j; +} + + +int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, +# 1012 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1012 "../../../server-code/src/char/char.c" + load_everything) +{ + int i,j; + char t_msg[128] = ""; + struct mmo_charstatus* cp; + StringBuf buf; + struct SqlStmt *stmt; + char last_map[((11 + 1) + 4)]; + char save_map[((11 + 1) + 4)]; + char point_map[((11 + 1) + 4)]; + struct point tmp_point; + struct item tmp_item; + struct s_skill tmp_skill; + struct s_friend tmp_friend; + + struct hotkey tmp_hotkey; + int hotkey_num = 0; + + unsigned int opt; + int account_id; + char sex[2]; + + do { if (((void)(p), +# 1034 "../../../server-code/src/char/char.c" 3 4 +0 +# 1034 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + memset(p, 0, sizeof(struct mmo_charstatus)); + + if (save_log) (showmsg->showInfo(("Char load request (%d)\n"), char_id)); + + stmt = SQL->StmtMalloc(inter->sql_handle); + if( stmt == +# 1041 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1041 "../../../server-code/src/char/char.c" + ) + { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1043)); + return 0; + } + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT " + "`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`," + "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," + "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," + "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," + "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" + " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + , +# 1058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1058 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + , +# 1059 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1059 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + , +# 1060 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1060 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + , +# 1061 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1061 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + , +# 1062 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1062 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + , +# 1063 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1063 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + , +# 1064 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + , +# 1065 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1065 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + , +# 1066 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1066 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + , +# 1067 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1067 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + , +# 1068 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1068 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + , +# 1069 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1069 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + , +# 1070 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1070 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + , +# 1071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1071 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + , +# 1072 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1072 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + , +# 1073 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1073 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + , +# 1074 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1074 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + , +# 1075 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1075 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + , +# 1076 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1076 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + , +# 1077 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1077 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + , +# 1078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1078 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + , +# 1079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1079 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + , +# 1080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1080 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + , +# 1081 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1081 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + , +# 1082 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1082 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + , +# 1083 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1083 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + , +# 1084 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1084 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + , +# 1085 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1085 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + , +# 1086 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1086 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + , +# 1087 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1087 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + , +# 1088 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1088 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + , +# 1089 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1089 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + , +# 1090 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1090 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + , +# 1091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1091 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + , +# 1092 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1092 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + , +# 1093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1093 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + , +# 1094 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1094 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + , +# 1095 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1095 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + , +# 1096 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1096 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + , +# 1097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1097 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + , +# 1098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1098 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + , +# 1099 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1099 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + , +# 1100 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1100 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + , +# 1101 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1101 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + , +# 1102 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1102 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + , +# 1103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1103 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + , +# 1104 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1104 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + , +# 1105 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1105 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + , +# 1106 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1106 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + , +# 1107 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1107 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + , +# 1108 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1108 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + , +# 1109 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1109 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + , +# 1110 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1110 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + , +# 1111 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1111 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + , +# 1112 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1112 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + , +# 1113 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + , +# 1114 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1114 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + , +# 1115 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1115 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + , +# 1116 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1116 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1118)); + SQL->StmtFree(stmt); + return 0; + } + if (0 != SQL->StmtNextRow(stmt)) + { + (showmsg->showError(("Requested non-existant character id: %d!\n"), char_id)); + SQL->StmtFree(stmt); + return 0; + } + + p->sex = chr->mmo_gender( +# 1129 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1129 "../../../server-code/src/char/char.c" + , p, sex[0]); + + account_id = p->account_id; + + p->last_point.map = mapindex->name2id(last_map); + p->save_point.map = mapindex->name2id(save_map); + + if( p->last_point.map == 0 ) { + p->last_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->last_point.x = mapindex->default_x; + p->last_point.y = mapindex->default_y; + } + + if( p->save_point.map == 0 ) { + p->save_point.map = (unsigned short)( DB->data2i((mapindex->db)->get((mapindex->db),DB->str2key(mapindex->default_map))) ); + p->save_point.x = mapindex->default_x; + p->save_point.y = mapindex->default_y; + } + + strcat(t_msg, " status"); + + if (!load_everything) + { + SQL->StmtFree(stmt); + return 1; + } + + + + memset(&tmp_point, 0, sizeof(tmp_point)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, 3) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + , +# 1162 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1162 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + , +# 1163 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1163 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + , +# 1164 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1164 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1166)); + + for( i = 0; i < 3 && 0 == SQL->StmtNextRow(stmt); ++i ) { + tmp_point.map = mapindex->name2id(point_map); + memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point)); + } + strcat(t_msg, " memo"); + + + + StrBuf->Init(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `bound`, `unique_id`"); + for( i = 0; i < 4; ++i ) + StrBuf->Printf(&buf, ", `card%d`", i); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + , +# 1186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1186 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + , +# 1187 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1187 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + , +# 1188 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1188 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + , +# 1189 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1189 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + , +# 1190 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + , +# 1191 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1191 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + , +# 1192 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1192 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + , +# 1193 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1193 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + , +# 1194 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1194 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + , +# 1195 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1195 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 10, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + , +# 1196 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1196 "../../../server-code/src/char/char.c" + ) + ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1198)); + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + , +# 1200 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1200 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1201)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item)); + + strcat(t_msg, " inventory"); + + + + StrBuf->Clear(&buf); + StrBuf->AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for( j = 0; j < 4; ++j ) + StrBuf->Printf(&buf, ", `card%d`", j); + StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, 100); + + memset(&tmp_item, 0, sizeof(tmp_item)); + if ((-1) == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + , +# 1220 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1220 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + , +# 1221 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1221 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + , +# 1222 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1222 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &tmp_item.equip, 0, +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + , +# 1223 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1223 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + , +# 1224 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1224 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + , +# 1225 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1225 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + , +# 1226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1226 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + , +# 1227 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1227 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &tmp_item.bound, 0, +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + , +# 1228 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1228 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &tmp_item.unique_id, 0, +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + , +# 1229 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1229 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1231)); + } + for( i = 0; i < 4; ++i ) + if( (-1) == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + , +# 1234 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1234 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1235)); + + for( i = 0; i < 100 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item)); + strcat(t_msg, " cart"); + + + inter_storage->fromsql(p->account_id, &p->storage); + strcat(t_msg, " storage"); + + + + memset(&tmp_skill, 0, sizeof(tmp_skill)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, 1478) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + , +# 1251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1251 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + , +# 1252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1252 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + , +# 1253 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1253 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1255)); + } + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; + + for( i = 0; i < 1478 && 0 == SQL->StmtNextRow(stmt); ++i ) { + if( skillid2idx[tmp_skill.id] ) + memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " skills"); + + + + memset(&tmp_friend, 0, sizeof(tmp_friend)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, 40) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + , +# 1275 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1275 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + , +# 1276 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1276 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + , +# 1277 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1277 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1279)); + } + + for( i = 0; i < 40 && 0 == SQL->StmtNextRow(stmt); ++i ) + memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend)); + strcat(t_msg, " friends"); + + + + + memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + , +# 1293 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1293 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + , +# 1294 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1294 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + , +# 1295 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1295 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + , +# 1296 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1296 "../../../server-code/src/char/char.c" + ) ) + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1297)); + + while( 0 == SQL->StmtNextRow(stmt) ) + { + if( hotkey_num >= 0 && hotkey_num < 38 ) + memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); + else + (showmsg->showWarning(("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n"), hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id)); + } + strcat(t_msg, " hotkeys"); + + + + inter_mercenary->owner_fromsql(char_id, p); + strcat(t_msg, " mercenary"); + + + p->mod_exp = p->mod_drop = p->mod_death = 100; + + + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) + || (-1) == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || (-1) == SQL->StmtExecute(stmt) + || (-1) == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + , +# 1320 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1320 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + , +# 1321 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1321 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + , +# 1322 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1322 "../../../server-code/src/char/char.c" + ) + || (-1) == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + , +# 1323 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1323 "../../../server-code/src/char/char.c" + ) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 1325)); + } + + if( 0 == SQL->StmtNextRow(stmt) ) + strcat(t_msg, " accdata"); + + if (save_log) (showmsg->showInfo(("Loaded char (%d - %s): %s\n"), char_id, p->name, t_msg)); + SQL->StmtFree(stmt); + StrBuf->Destroy(&buf); + + + if( opt & OPT_ALLOW_PARTY ) + p->allow_party = +# 1337 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1337 "../../../server-code/src/char/char.c" + ; + if( opt & OPT_SHOW_EQUIP ) + p->show_equip = +# 1339 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1339 "../../../server-code/src/char/char.c" + ; + + cp = ( DB->data2ptr((chr->char_db_)->ensure((chr->char_db_),DB->i2key(char_id),(chr->create_charstatus))) ); + memcpy(cp, p, sizeof(struct mmo_charstatus)); + return 1; +} + + +int char_mmo_char_sql_init(void) +{ + chr->char_db_= DB->alloc("../../../server-code/src/char/char.c",__func__,1349,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); +# 1358 "../../../server-code/src/char/char.c" + chr->set_all_offline_sql(); + + return 0; +} + + + +# 1364 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 1364 "../../../server-code/src/char/char.c" + char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + struct mmo_charstatus char_dat; + int from_id = 0; + + do { if (((void)(sd), +# 1368 "../../../server-code/src/char/char.c" 3 4 +0 +# 1368 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if( from >= 9 || to >= 9 || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) + return +# 1370 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1370 "../../../server-code/src/char/char.c" + ; + + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, +# 1372 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1372 "../../../server-code/src/char/char.c" + ) ) + return +# 1373 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1373 "../../../server-code/src/char/char.c" + ; + + if( char_dat.slotchange == 0 ) + return +# 1376 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1376 "../../../server-code/src/char/char.c" + ; + + from_id = sd->found_char[from]; + + if( sd->found_char[to] > 0 ) { + +# 1381 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 1381 "../../../server-code/src/char/char.c" + result = +# 1381 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1381 "../../../server-code/src/char/char.c" + ; + + if( 0 != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1387)); + else + result = +# 1389 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1389 "../../../server-code/src/char/char.c" + ; + + if( (-1) == SQL->QueryStr(inter->sql_handle, (result == +# 1391 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1391 "../../../server-code/src/char/char.c" + ) ? "COMMIT" : "ROLLBACK") ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1392)); + result = +# 1393 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1393 "../../../server-code/src/char/char.c" + ; + } + if( !result ) + return +# 1396 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1396 "../../../server-code/src/char/char.c" + ; + } else { + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1399)); + return +# 1400 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1400 "../../../server-code/src/char/char.c" + ; + } + } + + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1406)); + return +# 1407 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1407 "../../../server-code/src/char/char.c" + ; + } + + return +# 1410 "../../../server-code/src/char/char.c" 3 4 + 1 +# 1410 "../../../server-code/src/char/char.c" + ; +} + + + + +int char_rename_char_sql(struct char_session_data *sd, int char_id) +{ + struct mmo_charstatus char_dat; + char esc_name[(23 + 1)*2+1]; + + do { if (((void)(sd), +# 1421 "../../../server-code/src/char/char.c" 3 4 +0 +# 1421 "../../../server-code/src/char/char.c" +)) return(2); } while(0); + + if( sd->new_name[0] == 0 ) + return 2; + + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 1426 "../../../server-code/src/char/char.c" 3 4 + 0 +# 1426 "../../../server-code/src/char/char.c" + ) ) + return 2; + + if (sd->account_id != char_dat.account_id) + return 2; + + if( char_dat.rename == 0 ) + return 1; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, (strlib->strnlen_((sd->new_name),((23 + 1))))); + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1440)); + return 4; + } + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1446)); + return 3; + } + + + if( char_dat.guild_id ) + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + + (strlib->safestrncpy_((char_dat.name),(sd->new_name),((23 + 1)))); + memset(sd->new_name,0,sizeof(sd->new_name)); + + + if( log_char ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", + charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1464)); + } + + return 0; +} + +int char_check_char_name(char * name, char * esc_name) +{ + int i; + + do { if (((void)(name), +# 1474 "../../../server-code/src/char/char.c" 3 4 +0 +# 1474 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(esc_name), +# 1475 "../../../server-code/src/char/char.c" 3 4 +0 +# 1475 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + + + if (name[0] == '\0') + return -2; + + + + + if( strlen( name ) < 4 ) + return -2; + + if( (strlib->remove_control_chars_(name)) ) + return -2; + + + if( strcasecmp(name, wisp_server_name) == 0 ) + return -1; + + + if( char_name_option == 1 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) == +# 1498 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1498 "../../../server-code/src/char/char.c" + ) + return -2; + } + else if( char_name_option == 2 ) + { + for( i = 0; i < (23 + 1) && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != +# 1504 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1504 "../../../server-code/src/char/char.c" + ) + return -5; + } + if( name_ignoring_case ) { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1509)); + return -2; + } + } else { + if( (-1) == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1514)); + return -2; + } + } + if( SQL->NumRows(inter->sql_handle) > 0 ) + return -1; + + return 0; +} +# 1534 "../../../server-code/src/char/char.c" +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int char_id, flag, k, l; + + do { if (((void)(sd), +# 1540 "../../../server-code/src/char/char.c" 3 4 +0 +# 1540 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + do { if (((void)(name_), +# 1541 "../../../server-code/src/char/char.c" 3 4 +0 +# 1541 "../../../server-code/src/char/char.c" +)) return(-2); } while(0); + (strlib->safestrncpy_((name),(name_),((23 + 1)))); + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + flag = chr->check_char_name(name,esc_name); + if( flag < 0 ) + return flag; + + + + if(slot < 0 || slot >= sd->char_slots) + + + + + + + + return -4; + + + + + + if( sd->found_char[slot] != -1 ) + return -2; + + + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" + "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, + (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, + mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y, mapindex->id2name((start_point.map),"../../../server-code/src/char/char.c", 1576, __func__), start_point.x, start_point.y) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1578)); + return -2; + } +# 1595 "../../../server-code/src/char/char.c" + char_id = (int)SQL->LastInsertId(inter->sql_handle); + + if( !char_id ) + return -2; + + + if (log_char) { + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1605)); + } + + + for (k = 0; k < ( (int)(sizeof(start_items)/sizeof((start_items)[0])) ) && start_items[k] != 0; k += 3) { + + if( start_items[k+2] == 1 ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1616)); + } + else if( start_items[k+2] == 0 ) + { + + for( l = 0; l < start_items[k+1]; l++ ) + { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", + inventory_db, char_id, start_items[k], 1, 1) + ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1627)); + } + } + } + + (showmsg->showInfo(("Created char: account: %d, char: %d, slot: %d, name: %s\n"), sd->account_id, char_id, slot, name)); + return char_id; +} + + + + +int char_divorce_char_sql(int partner_id1, int partner_id2) +{ + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1644)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, 2634, 2635, partner_id1, partner_id2) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1646)); + + WBUFW(buf,0) = 0x2b12; + WBUFL(buf,2) = partner_id1; + WBUFL(buf,6) = partner_id2; + mapif->sendall(buf,10); + + return 0; +} + + + + + + + +int char_delete_char_sql(int char_id) +{ + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id; + char *data; + size_t len; + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1671)); + + if( 0 != SQL->NextRow(inter->sql_handle) ) + { + (showmsg->showError(("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"))); + SQL->FreeResult(inter->sql_handle); + return -1; + } + + SQL->GetData(inter->sql_handle, 0, &data, &len); (strlib->safestrncpy_((name),(data),((23 + 1)))); + SQL->GetData(inter->sql_handle, 1, &data, +# 1681 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1681 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 1682 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1682 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 1683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 1684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1684 "../../../server-code/src/char/char.c" + ); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 1685 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1685 "../../../server-code/src/char/char.c" + ); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, +# 1686 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1686 "../../../server-code/src/char/char.c" + ); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, +# 1687 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1687 "../../../server-code/src/char/char.c" + ); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, +# 1688 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1688 "../../../server-code/src/char/char.c" + ); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, +# 1689 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1689 "../../../server-code/src/char/char.c" + ); + elemental_id = atoi(data); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + SQL->FreeResult(inter->sql_handle); + + + + if( ( char_del_level > 0 && base_level >= char_del_level ) + || ( char_del_level < 0 && base_level <= -char_del_level ) + ) { + (showmsg->showInfo(("Char deletion aborted: %s, BaseLevel: %i\n"), name, base_level)); + return -1; + } + + + if( partner_id ) + chr->divorce_char_sql(char_id, partner_id); + + + if( father_id || mother_id ) + { + unsigned char buf[64]; + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1714)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1716)); + + WBUFW(buf,0) = 0x2b25; + WBUFL(buf,2) = father_id; + WBUFL(buf,6) = mother_id; + WBUFL(buf,10) = char_id; + mapif->sendall(buf,14); + } + + + if (party_id) + inter_party->leave(party_id, account_id, char_id); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1732)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1736)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1738)); + + + if( hom_id ) + mapif->homunculus_delete(hom_id); + + + if (elemental_id) + mapif->elemental_delete(elemental_id); + + + inter_mercenary->owner_delete(char_id); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1753)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1758)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1763)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1768)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1772)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1776)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1780)); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1782)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1786)); + + + if ((-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1790)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1795)); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1800)); + else if( log_char ) { + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" + " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", + charlog_db, account_id, char_id, 0, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1806)); + } + + + + + + + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1816)); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); + else if( guild_id ) + inter_guild->leave(guild_id, account_id, char_id); + return 0; +} + + + + +int char_count_users(void) +{ + int i, users; + + users = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + if (chr->server[i].fd > 0) { + users += chr->server[i].users; + } + } + return users; +} + + + + + +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { + unsigned short offset = 0; + uint8* buf; + + if( buffer == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + || p == +# 1848 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1848 "../../../server-code/src/char/char.c" + ) + return 0; + + buf = WBUFP(buffer,0); + WBUFL(buf,0) = p->char_id; + WBUFL(buf,4) = (((p->base_exp) < ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )) ? (p->base_exp) : ( +# 1853 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1853 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,8) = p->zeny; + WBUFL(buf,12) = (((p->job_exp) < ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )) ? (p->job_exp) : ( +# 1855 "../../../server-code/src/char/char.c" 3 4 + (2147483647) +# 1855 "../../../server-code/src/char/char.c" + )); + WBUFL(buf,16) = p->job_level; + WBUFL(buf,20) = 0; + WBUFL(buf,24) = 0; + WBUFL(buf,28) = (p->option &~ 0x40); + WBUFL(buf,32) = p->karma; + WBUFL(buf,36) = p->manner; + WBUFW(buf,40) = (((p->status_point) < ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )) ? (p->status_point) : ( +# 1862 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1862 "../../../server-code/src/char/char.c" + )); + + WBUFL(buf,42) = p->hp; + WBUFL(buf,46) = p->max_hp; + offset+=4; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,46) = (((p->sp) < ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )) ? (p->sp) : ( +# 1872 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1872 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,48) = (((p->max_sp) < ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )) ? (p->max_sp) : ( +# 1873 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1873 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,50) = 150; + WBUFW(buf,52) = p->class_; + WBUFW(buf,54) = p->hair; + + WBUFW(buf,56) = p->body; + offset+=2; + buf = WBUFP(buffer,offset); + + + + + WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon; + + WBUFW(buf,58) = p->base_level; + WBUFW(buf,60) = (((p->skill_point) < ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )) ? (p->skill_point) : ( +# 1888 "../../../server-code/src/char/char.c" 3 4 + (32767) +# 1888 "../../../server-code/src/char/char.c" + )); + WBUFW(buf,62) = p->head_bottom; + WBUFW(buf,64) = p->shield; + WBUFW(buf,66) = p->head_top; + WBUFW(buf,68) = p->head_mid; + WBUFW(buf,70) = p->hair_color; + WBUFW(buf,72) = p->clothes_color; + memcpy(WBUFP(buf,74), p->name, (23 + 1)); + WBUFB(buf,98) = (((p->str) < (((uint8) 0xFF))) ? (p->str) : (((uint8) 0xFF))); + WBUFB(buf,99) = (((p->agi) < (((uint8) 0xFF))) ? (p->agi) : (((uint8) 0xFF))); + WBUFB(buf,100) = (((p->vit) < (((uint8) 0xFF))) ? (p->vit) : (((uint8) 0xFF))); + WBUFB(buf,101) = (((p->int_) < (((uint8) 0xFF))) ? (p->int_) : (((uint8) 0xFF))); + WBUFB(buf,102) = (((p->dex) < (((uint8) 0xFF))) ? (p->dex) : (((uint8) 0xFF))); + WBUFB(buf,103) = (((p->luk) < (((uint8) 0xFF))) ? (p->luk) : (((uint8) 0xFF))); + WBUFW(buf,104) = p->slot; + + WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1; + offset += 2; + + + mapindex->getmapname_ext(mapindex->id2name((p->last_point.map),"../../../server-code/src/char/char.c", 1908, __func__), WBUFP(buf,108)); + offset += ((11 + 1) + 4); + + + WBUFL(buf,124) = (int)p->delete_date; + offset += 4; + + + WBUFL(buf,128) = p->robe; + offset += 4; + + + + WBUFL(buf,132) = ( p->slotchange > 0 ) ? 1 : 0; + offset += 4; + + + WBUFL(buf,136) = ( p->rename > 0 ) ? 1 : 0; + offset += 4; + + + WBUFB(buf,140) = p->sex; + offset += 1; + + + + return 106+offset; +} + + +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { + WFIFOHEAD(fd,4 + (9*150)); + WFIFOW(fd,0) = 0x99d; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int i; + time_t now = time( +# 1949 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 1949 "../../../server-code/src/char/char.c" + ); + + do { if (((void)(sd), +# 1951 "../../../server-code/src/char/char.c" 3 4 +0 +# 1951 "../../../server-code/src/char/char.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->unban_time[i]) break; } while( +# 1952 "../../../server-code/src/char/char.c" 3 4 +0 +# 1952 "../../../server-code/src/char/char.c" +); + if( i != 9 ) { + int c; + + WFIFOHEAD(fd, 4 + (9*24)); + + WFIFOW(fd,0) = 0x20d; + + for(i = 0, c = 0; i < 9; i++) { + if( sd->unban_time[i] ) { + timestamp2string(WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + + WFIFOL(fd, 4 + (24*c)) = 0; + + sd->unban_time[i] = 0; + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 1972)); + } + c++; + } + } + + WFIFOW(fd,2) = 4 + (24*c); + + WFIFOSET(fd, WFIFOW(fd,2)); + } +} + + + + +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { + do { if (((void)(sd), +# 1988 "../../../server-code/src/char/char.c" 3 4 +0 +# 1988 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,29); + WFIFOW(fd,0) = 0x82d; + WFIFOW(fd,2) = 29; + WFIFOB(fd,4) = sd->char_slots; + WFIFOB(fd,5) = 9 - sd->char_slots; + WFIFOB(fd,6) = 0; + WFIFOB(fd,7) = sd->char_slots; + WFIFOB(fd,8) = sd->char_slots; + memset(WFIFOP(fd,9), 0, 20); + WFIFOSET(fd,29); +} + + + +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +{ + int j, offset = 0; + do { if (((void)(sd), +# 2006 "../../../server-code/src/char/char.c" 3 4 +0 +# 2006 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + + offset += 3; + + if (save_log) + (showmsg->showInfo(("Loading Char Data (""\033[1m""%d""\033[0m"")\n"),sd->account_id)); + + j = 24 + offset; + WFIFOHEAD(fd,j + 9*150); + WFIFOW(fd,0) = 0x6b; + + WFIFOB(fd,4) = 9; + WFIFOB(fd,5) = sd->char_slots; + WFIFOB(fd,6) = 9; + + memset(WFIFOP(fd,4 + offset), 0, 20); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + WFIFOW(fd,2) = j; + WFIFOSET(fd,j); + + return 0; +} + +int char_char_married(int pl1, int pl2) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2032)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2037 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2037 "../../../server-code/src/char/char.c" + ); + if( pl2 == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_child(int parent_id, int child_id) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2051)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2056 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2056 "../../../server-code/src/char/char.c" + ); + if( child_id == atoi(data) ) + { + SQL->FreeResult(inter->sql_handle); + return 1; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + +int char_char_family(int cid1, int cid2, int cid3) +{ + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2070)); + else while( 0 == SQL->NextRow(inter->sql_handle) ) + { + int charid; + int partnerid; + int childid; + char* data; + + SQL->GetData(inter->sql_handle, 0, &data, +# 2078 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2078 "../../../server-code/src/char/char.c" + ); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 2079 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2079 "../../../server-code/src/char/char.c" + ); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 2080 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2080 "../../../server-code/src/char/char.c" + ); childid = atoi(data); + + if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || + (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || + (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) + { + SQL->FreeResult(inter->sql_handle); + return childid; + } + } + SQL->FreeResult(inter->sql_handle); + return 0; +} + + + + +void char_disconnect_player(int account_id) +{ + int i; + struct char_session_data* sd; + + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->account_id == account_id) break; } while( +# 2103 "../../../server-code/src/char/char.c" 3 4 +0 +# 2103 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) + sockt->eof(i); +} + +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +static void char_auth_ok(int fd, struct char_session_data *sd) +{ + struct online_char_data* character; + + do { if (((void)(sd), +# 2128 "../../../server-code/src/char/char.c" 3 4 +0 +# 2128 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) )) != +# 2130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2130 "../../../server-code/src/char/char.c" + ) { + + if (character->server > -1) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); + character->pincode_enable = -1; + chr->authfail_fd(fd, 8); + return; + } + if (character->fd >= 0 && character->fd != fd) { + + chr->authfail_fd(fd, 8); + return; + } + character->fd = fd; + } + + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); + } + + + sd->auth = +# 2154 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2154 "../../../server-code/src/char/char.c" + ; + + + chr->set_char_charselect(sd->account_id); + + +} + +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + + (showmsg->showError(("Can not connect to login-server.\n"))); + (showmsg->showError(("The server communication passwords (default s1/p1) are probably invalid.\n"))); + (showmsg->showError(("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"))); + (showmsg->showError(("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"))); + sockt->eof(fd); + return 1; + } else { + (showmsg->showStatus(("Connected to login-server (connection #%d).\n"), fd)); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} + + + +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ + struct char_session_data* sd = +# 2199 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2199 "../../../server-code/src/char/char.c" + ; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if (sockt->session_is_active(request_id) && (sd=(struct char_session_data*)sockt->session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0: + + if( chr->server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + + if( chr->server_type == CST_PAYING && (time_t)expiration_time < time( +# 2226 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2226 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1: + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + int i; + + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (sd = (struct char_session_data*)sockt->session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2)) break; } while( +# 2244 "../../../server-code/src/char/char.c" 3 4 +0 +# 2244 "../../../server-code/src/char/char.c" +); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > 9 ) { + (showmsg->showError(("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n"),sd->account_id,sd->char_slots)); + sd->char_slots = 9; + } else if ( sd->char_slots <= 0 ) + sd->char_slots = 9; + (strlib->safestrncpy_((sd->birthdate),(RFIFOP(fd,52)),(sizeof(sd->birthdate)))); + (strlib->safestrncpy_((sd->pincode),(RFIFOP(fd,63)),(sizeof(sd->pincode)))); + sd->pincode_change = RFIFOL(fd,68); + + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + + chr->auth_error(i, 0); + } else { + + + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + + + + + chr->mmo_char_send_ban_list(i, sd); + + + pincode->handle(i, sd); + + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + if (sockt->session[fd]) + sockt->session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} +# 2310 "../../../server-code/src/char/char.c" +void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id) +{ + + if (class_ == JOB_BARD || class_ == JOB_DANCER) + class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER); + else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY) + class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY); + else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER) + class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER) + class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER); + else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T) + class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER) + class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO) + class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2329)); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', " + "`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_, char_id)) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2334)); + if (guild_id) + inter_guild->sex_changed(guild_id, acc, char_id, sex); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id = 0, class_ = 0, guild_id = 0; + int i; + struct char_auth_node *node; + struct SqlStmt *stmt; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + + if (acc <= 0) { + (showmsg->showError(("Received invalid account id from login server! (aid: %d)\n"), acc)); + return 1; + } + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(acc))) ); + if (node != +# 2358 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2358 "../../../server-code/src/char/char.c" + ) + node->sex = sex; + + + stmt = SQL->StmtMalloc(inter->sql_handle); + if ((-1) == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) + || (-1) == SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 2366)); + SQL->StmtFree(stmt); + } + SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + , +# 2369 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2369 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + , +# 2370 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2370 "../../../server-code/src/char/char.c" + ); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + , +# 2371 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2371 "../../../server-code/src/char/char.c" + ); + + for (i = 0; i < 9 && 0 == SQL->StmtNextRow(stmt); ++i) { + char_change_sex_sub(sex, acc, char_id, class_, guild_id); + } + SQL->StmtFree(stmt); + + + chr->disconnect_player(acc); + + + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} + +void mapif_ban(int id, unsigned int flag, int status) +{ + + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; + WBUFL(buf,7) = status; + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) ); + RFIFOSKIP(fd,6); + if( character != +# 2417 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2417 "../../../server-code/src/char/char.c" + ) + { + if( character->server > -1 ) { + + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == (-1)) + character->waiting_disconnect = timer->add(timer->gettick()+30000, chr->waiting_disconnect, character->account_id, 0); + } + else + { + struct char_session_data *tsd; + int i; + do { for ((i) = (0); (i) < (sockt->fd_max); ++(i)) if (sockt->session[i] && (tsd = (struct char_session_data*)sockt->session[i]->session_data) && tsd->account_id == aid) break; } while( +# 2429 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2429 "../../../server-code/src/char/char.c" + ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + sockt->eof(i); + } + else + chr->set_char_offline(-1, aid); + } + } + ( (auth_db)->remove((auth_db),DB->i2key(aid), +# 2439 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2439 "../../../server-code/src/char/char.c" +) ); +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(chr->ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = sockt->host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; + + new_ip = sockt->host2ip(char_ip_str); + if (new_ip && new_ip != chr->ip) { + + chr->ip = new_ip; + (showmsg->showInfo(("Updating IP for [%s].\n"), char_ip_str)); + + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2( +# 2475 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2475 "../../../server-code/src/char/char.c" + , RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , +# 2476 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2476 "../../../server-code/src/char/char.c" + , -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2( +# 2482 "../../../server-code/src/char/char.c" 3 4 + 1 +# 2482 "../../../server-code/src/char/char.c" + , RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { + + if( fd != chr->login_fd ) { + (showmsg->showDebug(("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n"), fd)); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->login_fd = -1; + loginif->on_disconnect(); + return 0; + } else if ( sockt->session[fd]->flag.ping ) { + if( ((sockt->last_tick)-(sockt->session[fd]->rdata_tick)) > (sockt->stall_time * 2) ) { + sockt->eof(fd); + return 0; + } else if( sockt->session[fd]->flag.ping != 2 ) { + chr->ping_login_server(fd); + sockt->session[fd]->flag.ping = 2; + } + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromLogin])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromLogin); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2711: + if (RFIFOREST(fd) < 3) + return 0; + if (chr->parse_fromlogin_connection_state(fd)) + return 0; + break; + + + case 0x2713: + if (RFIFOREST(fd) < 33) + return 0; + { + chr->parse_fromlogin_auth_state(fd); + } + break; + + case 0x2717: + { + if (RFIFOREST(fd) < 72) + return 0; + chr->parse_fromlogin_account_data(fd); + } + break; + + + case 0x2718: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_fromlogin_login_pong(fd); + break; + + + case 0x2723: + if (RFIFOREST(fd) < 7) + return 0; + { + if (chr->parse_fromlogin_changesex_reply(fd)) + return 0; + } + break; + + + case 0x3804: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_fromlogin_account_reg2(fd); + break; + + + case 0x2731: + if (RFIFOREST(fd) < 11) + return 0; + chr->parse_fromlogin_ban(fd); + break; + + + case 0x2734: + if (RFIFOREST(fd) < 6) + return 0; + { + chr->parse_fromlogin_kick(fd); + } + break; + + + case 0x2735: + { + chr->parse_fromlogin_update_ip(fd); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 18) + return 0; + + chr->parse_fromlogin_accinfo2_failed(fd); + break; + + case 0x2737: + if (RFIFOREST(fd) < 183) + return 0; + + chr->parse_fromlogin_accinfo2_ok(fd); + break; + + default: + (showmsg->showError(("Unknown packet 0x%04x received from login-server, disconnecting.\n"), command)); + sockt->eof(fd); + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int char_request_accreg2(int account_id, int char_id) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); + return 1; + } + return 0; +} + + + + +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0; +} + + + + +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); +} + + + + +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, +# 2655 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 2655 "../../../server-code/src/char/char.c" + is_string) { + int nlen = WFIFOW(chr->login_fd,2); + size_t len = strlen(key)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(key),(len))); + nlen += len; + + WFIFOL(chr->login_fd, nlen) = index; + nlen += 4; + + if( is_string ) { + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; + nlen += 1; + + if( val ) { + char *sval = (char*)val; + len = strlen(sval)+1; + + WFIFOB(chr->login_fd, nlen) = (unsigned char)len; + nlen += 1; + + (strlib->safestrncpy_((WFIFOP(chr->login_fd,nlen)),(sval),(len))); + nlen += len; + } + } else { + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; + nlen += 1; + + if( val ) { + WFIFOL(chr->login_fd, nlen) = (int)val; + nlen += 4; + } + } + + WFIFOW(chr->login_fd,12) += 1; + + WFIFOW(chr->login_fd,2) = nlen; + if( WFIFOW(chr->login_fd,2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id); + } +} + +void char_read_fame_list(void) { + int i; + char* data; + size_t len; + + + memset(smith_fame_list, 0, sizeof(smith_fame_list)); + memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); + memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2713)); + for( i = 0; i < fame_list_size_smith && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2717 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2717 "../../../server-code/src/char/char.c" + ); + smith_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + smith_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(smith_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2728)); + for( i = 0; i < fame_list_size_chemist && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2732 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2732 "../../../server-code/src/char/char.c" + ); + chemist_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + chemist_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(chemist_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2743)); + for( i = 0; i < fame_list_size_taekwon && 0 == SQL->NextRow(inter->sql_handle); ++i ) + { + + SQL->GetData(inter->sql_handle, 0, &data, +# 2747 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 2747 "../../../server-code/src/char/char.c" + ); + taekwon_fame_list[i].id = atoi(data); + + SQL->GetData(inter->sql_handle, 1, &data, &len); + taekwon_fame_list[i].fame = atoi(data); + + SQL->GetData(inter->sql_handle, 2, &data, &len); + memcpy(taekwon_fame_list[i].name, data, (((len) < ((23 + 1))) ? (len) : ((23 + 1)))); + } + SQL->FreeResult(inter->sql_handle); +} + + +int char_send_fame_list(int fd) { + int i, len = 8; + unsigned char buf[32000]; + + WBUFW(buf,0) = 0x2b1b; + + for(i = 0; i < fame_list_size_smith && smith_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &smith_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,6) = len; + + for(i = 0; i < fame_list_size_chemist && chemist_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &chemist_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,4) = len; + + for(i = 0; i < fame_list_size_taekwon && taekwon_fame_list[i].id; i++) { + memcpy(WBUFP(buf, len), &taekwon_fame_list[i], sizeof(struct fame_list)); + len += sizeof(struct fame_list); + } + + WBUFW(buf,2) = len; + + if (fd != -1) + mapif->send(fd, buf, len); + else + mapif->sendall(buf, len); + + return 0; +} + +void char_update_fame_list(int type, int index, int fame) { + unsigned char buf[8]; + WBUFW(buf,0) = 0x2b22; + WBUFB(buf,2) = type; + WBUFB(buf,3) = index; + WBUFL(buf,4) = fame; + mapif->sendall(buf, 8); +} + + + +int char_loadName(int char_id, char* name) +{ + char* data; + size_t len; + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2812)); + else if( 0 == SQL->NextRow(inter->sql_handle) ) + { + SQL->GetData(inter->sql_handle, 0, &data, &len); + (strlib->safestrncpy_((name),(data),((23 + 1)))); + return 1; + } + else + { + (strlib->safestrncpy_((name),(unknown_char_name),((23 + 1)))); + } + return 0; +} + + +void mapif_server_init(int id) +{ + + chr->server[id].fd = -1; +} + + +void mapif_server_destroy(int id) +{ + if( chr->server[id].fd == -1 ) + { + sockt->close(chr->server[id].fd); + chr->server[id].fd = -1; + } +} + + + +void mapif_server_reset(int id) +{ + int i,j; + unsigned char buf[16384]; + int fd = chr->server[id].fd; + + WBUFW(buf,0) = 0x2b20; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + j = 0; + for (i = 0; i < ( (chr->server[id].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[id].maps)._data_ )[i] ); + if (m != 0) + WBUFW(buf,10+(j++)*4) = m; + } + if (j > 0) { + WBUFW(buf,2) = j * 4 + 10; + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, chr->server[id].fd) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2865)); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + mapif->server_destroy(id); + mapif->server_init(id); +} + + +void mapif_on_disconnect(int id) +{ + (showmsg->showStatus(("Map-server #%d has disconnected.\n"), id)); + mapif->server_reset(id); +} + +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + do { if (( (chr->login_fd > 0) ? +# 2879 "../../../server-code/src/char/char.c" 3 4 +0 +# 2879 "../../../server-code/src/char/char.c" +: (nullpo->assert_report("../../../server-code/src/char/char.c", 2879, __func__, "chr->login_fd > 0", "failed assertion"), +# 2879 "../../../server-code/src/char/char.c" 3 4 +1 +# 2879 "../../../server-code/src/char/char.c" +) )) return; } while(0); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); +} + +void char_parse_frommap_datasync(int fd) +{ + sockt->datasync(fd, +# 2892 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2892 "../../../server-code/src/char/char.c" + ); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + int i; + int j = RFIFOW(fd, 2) - 4; + + memset(&skillid2idx, 0, sizeof(skillid2idx)); + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > 10015 ) { + (showmsg->showWarning(("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n"),RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),10015)); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + (23 + 1)); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, (23 + 1)); + WFIFOSET(fd,3+(23 + 1)); +} + +void char_send_maps(int fd, int id, int j) +{ + int k,i; + + if (j == 0) { + (showmsg->showWarning(("Map-server %d has NO maps.\n"), id)); + } else { + unsigned char buf[16384]; + + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(chr->server[id].ip); + WBUFW(buf,8) = htons(chr->server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + + for(k = 0; k < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); k++) { + if (chr->server[k].fd > 0 && k != id) { + WFIFOHEAD(fd,10 + 4 * ( (chr->server[k].maps)._len_ )); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(chr->server[k].ip); + WFIFOW(fd,8) = htons(chr->server[k].port); + j = 0; + for(i = 0; i < ( (chr->server[k].maps)._len_ ); i++) { + uint16 m = ( ( (chr->server[k].maps)._data_ )[i] ); + if (m != 0) + WFIFOW(fd,10+(j++)*4) = m; + } + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + int i; + + do { if (( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2964, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2964 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2964 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } } while( +# 2964 "../../../server-code/src/char/char.c" 3 4 +0 +# 2964 "../../../server-code/src/char/char.c" +); + do { int _empty_ = ( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ); if (((RFIFOW(fd, 2) - 4) / 4) > _empty_) { while (((RFIFOW(fd, 2) - 4) / 4) > _empty_) _empty_ += (1); do { if ((_empty_+( (chr->server[id].maps)._len_ )) > ( (chr->server[id].maps)._max_ )) { if (( (chr->server[id].maps)._max_ ) == 0) ( (chr->server[id].maps)._data_ ) = (iMalloc->malloc(((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); else ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); memset(( (chr->server[id].maps)._data_ )+( (chr->server[id].maps)._len_ ), 0, (( (chr->server[id].maps)._max_ )-( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } else if ((_empty_+( (chr->server[id].maps)._len_ )) == 0 && ( (chr->server[id].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[id].maps)._data_ )),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._data_ ) = +# 2965 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 2965 "../../../server-code/src/char/char.c" +; ( (chr->server[id].maps)._max_ ) = 0; ( (chr->server[id].maps)._len_ ) = 0; } else if ((_empty_+( (chr->server[id].maps)._len_ )) < ( (chr->server[id].maps)._max_ )) { ( (chr->server[id].maps)._data_ ) = (iMalloc->realloc((( (chr->server[id].maps)._data_ )),((_empty_+( (chr->server[id].maps)._len_ ))*sizeof(( ( ( (chr->server[id].maps)._data_ )[0] ) ))),"../../../server-code/src/char/char.c", 2965, __func__)); ( (chr->server[id].maps)._max_ ) = (_empty_+( (chr->server[id].maps)._len_ )); if ((_empty_+( (chr->server[id].maps)._len_ )) - ( (chr->server[id].maps)._len_ ) > 0) ( (chr->server[id].maps)._len_ ) = (_empty_+( (chr->server[id].maps)._len_ )); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); } } while( +# 2965 "../../../server-code/src/char/char.c" 3 4 +0 +# 2965 "../../../server-code/src/char/char.c" +); + for (i = 4; i < RFIFOW(fd,2); i += 4) { + do { ( ( (chr->server[id].maps)._data_ )[( (chr->server[id].maps)._len_ )] ) = (RFIFOW(fd,i)); ++( (chr->server[id].maps)._len_ ); }while( +# 2967 "../../../server-code/src/char/char.c" 3 4 + 0 +# 2967 "../../../server-code/src/char/char.c" + ); + } + + (showmsg->showStatus(("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n"), id, (int)( (chr->server[id].maps)._len_ ), CONVIP(chr->server[id].ip), chr->server[id].port)) + ; + (showmsg->showStatus(("Map-server %d loading complete.\n"), id)); + + + chr->map_received_ok(fd); + chr->send_fame_list(fd); + chr->send_maps(fd, id, (int)( (chr->server[id].maps)._len_ )); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 2988)); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && 0 == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, +# 3003 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3003 "../../../server-code/src/char/char.c" + ); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3004 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3004 "../../../server-code/src/char/char.c" + ); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3005 "../../../server-code/src/char/char.c" + ); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, +# 3006 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3006 "../../../server-code/src/char/char.c" + ); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, +# 3007 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3007 "../../../server-code/src/char/char.c" + ); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, +# 3008 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3008 "../../../server-code/src/char/char.c" + ); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + (showmsg->showWarning(("Too many status changes for %d:%d, some of them were not loaded.\n"), aid, cid)); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3020)); + } + } else { + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + +} + +void char_parse_frommap_request_scdata(int fd) +{ + + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != chr->server[id].users) { + chr->server[id].users = RFIFOW(fd,2); + (showmsg->showInfo(("User Count: %d (Server: %d)\n"), chr->server[id].users, id)); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + + int i; + + chr->server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); + for(i = 0; i < chr->server[id].users; i++) { + int aid = RFIFOL(fd,6+i*8); + int cid = RFIFOL(fd,6+i*8+4); + struct online_char_data *character = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(aid),(chr->create_online_char_data))) ); + if (character->server > -1 && character->server != id) { + (showmsg->showNotice(("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n"), character->account_id, character->char_id, character->server, id, aid, cid)) + ; + mapif->disconnectplayer(chr->server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + (showmsg->showError(("parse_from_map (save-char): Size mismatch! %d != %""z" "u""\n"), size-13, sizeof(struct mmo_charstatus))); + RFIFOSKIP(fd,size); + return; + } + + if (RFIFOB(fd,12) + || ( (character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(aid))) )) != +# 3098 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) + +# 3099 "../../../server-code/src/char/char.c" + && character->char_id == cid) + ) { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { + + (showmsg->showError(("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n"), aid, cid)); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) { + + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + + + +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( core->runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3147, __func__))); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + + node->ip = ntohl(ip); + + + + ( (auth_db)->put((auth_db),DB->i2key(account_id),DB->ptr2data(node), +# 3158 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3158 "../../../server-code/src/char/char.c" + ) ); + + + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, const uint8 *data, +# 3166 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 3166 "../../../server-code/src/char/char.c" + ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); + if (map_id >= 0) + map_fd = chr->server[map_id].fd; + + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + if (char_data == +# 3186 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3186 "../../../server-code/src/char/char.c" + ) { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, +# 3189 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3189 "../../../server-code/src/char/char.c" + ); + char_data = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(RFIFOL(fd,14)))) ); + } + + if (core->runflag == CHARSERVER_ST_RUNNING && sockt->session_is_active(map_fd) && char_data) { + + struct online_char_data* data; + struct char_auth_node* node; + + + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 3205, __func__))); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + ( (auth_db)->put((auth_db),DB->i2key(RFIFOL(fd,2)),DB->ptr2data(node), +# 3215 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3215 "../../../server-code/src/char/char.c" + ) ); + + data = ( DB->data2ptr((chr->online_char_db)->ensure((chr->online_char_db),DB->i2key(RFIFOL(fd,2)),(chr->create_online_char_data))) ); + data->char_id = char_data->char_id; + data->server = map_id; + + + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3222 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3222 "../../../server-code/src/char/char.c" + ); + } else { + chr->change_map_server_ack(fd, RFIFOP(fd,2), +# 3224 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3224 "../../../server-code/src/char/char.c" + ); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3235)); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); + + do { if (((void)(unban_time), +# 3282 "../../../server-code/src/char/char.c" 3 4 +0 +# 3282 "../../../server-code/src/char/char.c" +)) return; } while(0); + + if (*unban_time == 0 || *unban_time < time( +# 3284 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3284 "../../../server-code/src/char/char.c" + )) + timestamp = time( +# 3285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3285 "../../../server-code/src/char/char.c" + ); + else + timestamp = *unban_time; + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( 0 != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || 0 != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) + || 0 != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || 0 != SQL->StmtExecute(stmt) + ) { + (SQL->StmtShowDebug_((stmt), "../../../server-code/src/char/char.c", 3305)); + } + + SQL->StmtFree(stmt); + + + if( timestamp > time( +# 3311 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3311 "../../../server-code/src/char/char.c" + ) ) { + mapif->char_ban(char_id, timestamp); + + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + + if( (-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3322)); + if (result) + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + do { if (((void)(name), +# 3330 "../../../server-code/src/char/char.c" 3 4 +0 +# 3330 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} +# 3350 "../../../server-code/src/char/char.c" +int char_changecharsex(int char_id, int sex) +{ + int class_ = 0, guild_id = 0, account_id = 0; + char *data; + + + if ((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", char_db, char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3357)); + return 1; + } + if (SQL->NumRows(inter->sql_handle) != 1 || (-1) == SQL->NextRow(inter->sql_handle)) { + SQL->FreeResult(inter->sql_handle); + return 1; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 3364 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3364 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3365 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3365 "../../../server-code/src/char/char.c" + ); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3366 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3366 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + if ((-1) == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3370)); + return 1; + } + char_change_sex_sub(sex, account_id, char_id, class_, guild_id); + + + chr->disconnect_player(account_id); + + + chr->changesex(account_id, sex); + return 0; +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; + char esc_name[(23 + 1)*2+1]; + + int acc = RFIFOL(fd,2); + const char *name = RFIFOP(fd,6); + int type = RFIFOW(fd,30); + short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; + int sex = SEX_MALE; + if (type == 2 || type == 6) { + year = RFIFOW(fd,32); + month = RFIFOW(fd,34); + day = RFIFOW(fd,36); + hour = RFIFOW(fd,38); + minute = RFIFOW(fd,40); + second = RFIFOW(fd,42); + } else if (type == 8) { + sex = RFIFOB(fd, 32); + } + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + + if((-1) == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3408)); + } else if (SQL->NumRows(inter->sql_handle) == 0) { + SQL->FreeResult(inter->sql_handle); + result = 1; + } else if (0 != SQL->NextRow(inter->sql_handle)) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3413)); + SQL->FreeResult(inter->sql_handle); + result = 1; + } else { + int account_id, char_id; + char *data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, +# 3421 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3421 "../../../server-code/src/char/char.c" + ); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 3422 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3422 "../../../server-code/src/char/char.c" + ); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, +# 3423 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3423 "../../../server-code/src/char/char.c" + ); unban_time = atol(data); + SQL->FreeResult(inter->sql_handle); + + if( chr->login_fd <= 0 ) { + result = 3; + + + + + } else { + switch (type) { + case CHAR_ASK_NAME_BLOCK: + loginif->block_account(account_id, 5); + break; + case CHAR_ASK_NAME_BAN: + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_UNBLOCK: + loginif->block_account(account_id, 0); + break; + case CHAR_ASK_NAME_UNBAN: + loginif->unban_account(account_id); + break; + case CHAR_ASK_NAME_CHANGESEX: + loginif->changesex(account_id); + break; + case CHAR_ASK_NAME_CHARBAN: + + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + break; + case CHAR_ASK_NAME_CHARUNBAN: + chr->unban(char_id, &result); + break; + case CHAR_ASK_NAME_CHANGECHARSEX: + result = chr->changecharsex(char_id, sex); + break; + } + } + } + + + if (acc != -1 && type != CHAR_ASK_NAME_CHANGESEX && type != CHAR_ASK_NAME_CHANGECHARSEX) { + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = +# 3483 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3483 "../../../server-code/src/char/char.c" + ; break; + } + + if (!list) { + RFIFOSKIP(fd, 11); + return; + } + do { for ((player_pos) = (0); (player_pos) < (size); ++(player_pos)) if (list[player_pos].id == cid) break; } while( +# 3490 "../../../server-code/src/char/char.c" 3 4 +0 +# 3490 "../../../server-code/src/char/char.c" +); + do { for ((fame_pos) = (0); (fame_pos) < (size); ++(fame_pos)) if (list[fame_pos].fame <= fame) break; } while( +# 3491 "../../../server-code/src/char/char.c" 3 4 +0 +# 3491 "../../../server-code/src/char/char.c" +); + + if( player_pos == size && fame_pos == size ) + ; + else if( fame_pos == player_pos ) { + + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + + if( player_pos == size ) { + + do { if ((size - 1) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(size - 1), sizeof(struct fame_list)); if ((size - 1) < (fame_pos)) memmove((list)+(size - 1), (list)+(size - 1)+1, ((fame_pos)-(size - 1))*sizeof(struct fame_list)); else if ((size - 1) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((size - 1)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3503 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3503 "../../../server-code/src/char/char.c" + ); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + + if( fame_pos == size ) + --fame_pos; + do { if ((player_pos) != (fame_pos)) { struct fame_list _backup_; memmove(&_backup_, (list)+(player_pos), sizeof(struct fame_list)); if ((player_pos) < (fame_pos)) memmove((list)+(player_pos), (list)+(player_pos)+1, ((fame_pos)-(player_pos))*sizeof(struct fame_list)); else if ((player_pos) > (fame_pos)) memmove((list)+(fame_pos)+1, (list)+(fame_pos), ((player_pos)-(fame_pos))*sizeof(struct fame_list)); memmove((list)+(fame_pos), &_backup_, sizeof(struct fame_list)); } } while( +# 3511 "../../../server-code/src/char/char.c" 3 4 + 0 +# 3511 "../../../server-code/src/char/char.c" + ); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(chr->server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name); + + if( (-1) == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3535)); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3574)); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + int i; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( (-1) == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3593)); + StrBuf->Destroy(&buf); + } + + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + do { if (((void)(cd), +# 3615 "../../../server-code/src/char/char.c" 3 4 +0 +# 3615 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + struct char_auth_node* node; + struct mmo_charstatus* cd; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + + if( cd == +# 3669 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3669 "../../../server-code/src/char/char.c" + ) { + chr->mmo_char_fromsql(char_id, &char_dat, +# 3670 "../../../server-code/src/char/char.c" 3 4 + 1 +# 3670 "../../../server-code/src/char/char.c" + ); + cd = (struct mmo_charstatus*)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->ui2key(char_id))) ); + } + + if( core->runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, +# 3677 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3677 "../../../server-code/src/char/char.c" + , cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( core->runflag == CHARSERVER_ST_RUNNING && + cd != +# 3683 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3683 "../../../server-code/src/char/char.c" + && + node != +# 3684 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3684 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 + + ) + { + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 3696 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 3696 "../../../server-code/src/char/char.c" + ) ); + chr->set_char_online(id, char_id, account_id); + } + else + { + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + chr->server[id].ip = ntohl(RFIFOL(fd, 2)); + (showmsg->showInfo(("Updated IP address of map-server #%d to %u.%u.%u.%u.\n"), id, CONVIP(chr->server[id].ip))); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd; + struct hSockOpt opt; + RFIFOSKIP(fd, 2); + + opt.silent = 1; + opt.setTimeo = 1; + + if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); + return; + } + + sockt->session[sfd]->flag.server = 1; + sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + do { + sockt->flush(sfd); + sleep(1); + } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); + + sockt->close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) ); + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if ((-1) == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" + " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, (-1), val1, val2, val3, val4) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3762)); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 3776)); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int id; + + do { for ((id) = (0); (id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(id)) if (chr->server[id].fd == fd) break; } while( +# 3785 "../../../server-code/src/char/char.c" 3 4 +0 +# 3785 "../../../server-code/src/char/char.c" +); + if( id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + (showmsg->showDebug(("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n"), fd)); + sockt->close(fd); + return 0; + } + if( sockt->session[fd]->flag.eof ) { + sockt->close(fd); + chr->server[id].fd = -1; + mapif->on_disconnect(id); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + int packet_id = RFIFOW(fd,0); + if (( (HPM->packets[hpParse_FromMap])._len_ ) > 0) { + int result = HPM->parse_packets(fd,packet_id,hpParse_FromMap); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (packet_id) { + case 0x2b0a: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_datasync(fd); + break; + + case 0x2b0b: + if( RFIFOREST(fd) < RFIFOW(fd, 2) ) + return 0; + chr->parse_frommap_skillid2idx(fd); + break; + case 0x2afa: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + chr->parse_frommap_map_names(fd, id); + break; + + case 0x2afc: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_request_scdata(fd); + } + break; + + case 0x2afe: + if (RFIFOREST(fd) < 4) + return 0; + chr->parse_frommap_set_users_count(fd, id); + break; + + case 0x2aff: + if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_set_users(fd, id); + } + break; + + case 0x2b01: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_character(fd, id); + + } + break; + + case 0x2b02: + if( RFIFOREST(fd) < 22 ) + return 0; + { + chr->parse_frommap_char_select_req(fd); + } + break; + + case 0x2b05: + if (RFIFOREST(fd) < 39) + return 0; + { + chr->parse_frommap_change_map_server(fd); + } + break; + + case 0x2b07: + if (RFIFOREST(fd) < 10) + return 0; + { + chr->parse_frommap_remove_friend(fd); + } + break; + + case 0x2b08: + if (RFIFOREST(fd) < 6) + return 0; + + chr->parse_frommap_char_name_request(fd); + break; + + case 0x2b0c: + if (RFIFOREST(fd) < 86) + return 0; + chr->parse_frommap_change_email(fd); + break; + + case 0x2b0e: + if (RFIFOREST(fd) < 44) + return 0; + { + chr->parse_frommap_change_account(fd); + } + break; + + case 0x2b10: + if (RFIFOREST(fd) < 11) + return 0; + { + chr->parse_frommap_fame_list(fd); + } + break; + + + case 0x2b11: + if( RFIFOREST(fd) < 10 ) + return 0; + + chr->parse_frommap_divorce_char(fd); + break; + + case 0x2b16: + if( RFIFOREST(fd) < 14 ) + return 0; + { + chr->parse_frommap_ragsrvinfo(fd); + } + break; + + case 0x2b17: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_frommap_set_char_offline(fd); + break; + + case 0x2b18: + chr->parse_frommap_set_all_offline(fd, id); + break; + + case 0x2b19: + if (RFIFOREST(fd) < 10) + return 0; + chr->parse_frommap_set_char_online(fd, id); + break; + + case 0x2b1a: + if (RFIFOREST(fd) < 2) + return 0; + chr->parse_frommap_build_fame_list(fd); + break; + + case 0x2b1c: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + chr->parse_frommap_save_status_change_data(fd); + } + break; + + case 0x2b23: + chr->parse_frommap_ping(fd); + break; + + case 0x2b26: + if (RFIFOREST(fd) < 20) + return 0; + + { + chr->parse_frommap_auth_request(fd, id); + } + break; + + case 0x2736: + if (RFIFOREST(fd) < 6) return 0; + chr->parse_frommap_update_ip(fd, id); + break; + + case 0x3008: + if( RFIFOREST(fd) < RFIFOW(fd,4) ) + return 0; + else { + chr->parse_frommap_request_stats_report(fd); + } + break; + + + case 0x2740: + if( RFIFOREST(fd) < 28 ) + return 0; + else { + chr->parse_frommap_scdata_update(fd); + } + break; + + + case 0x2741: + if( RFIFOREST(fd) < 12 ) + return 0; + else { + chr->parse_frommap_scdata_delete(fd); + } + break; + + default: + { + + int r = inter->parse_frommap(fd); + if (r == 1) break; + if (r == 2) return 0; + + + (showmsg->showError(("Unknown packet 0x%04x from map server, disconnecting.\n"), RFIFOW(fd,0))); + sockt->eof(fd); + return 0; + } + } + } + + return 0; +} + +void do_init_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_init(i); +} + +void do_final_mapif(void) +{ + int i; + for( i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++i ) + mapif->server_destroy(i); +} + + + +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +{ + int i, j; + + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) + { + if (chr->server[i].fd > 0 + && (ip == (uint32)-1 || chr->server[i].ip == ip) + && (port == (uint16)-1 || chr->server[i].port == port) + ) { + do { for ((j) = (0); (j) < (( (chr->server[i].maps)._len_ )); ++(j)) if (( ( (chr->server[i].maps)._data_ )[j] ) == map) break; } while( +# 4044 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4044 "../../../server-code/src/char/char.c" + ); + if (j != ( (chr->server[i].maps)._len_ )) + return i; + } + } + + return -1; +} + + +static int char_mapif_init(int fd) +{ + return inter->mapif_init(fd); +} +# 4066 "../../../server-code/src/char/char.c" +uint32 char_lan_subnet_check(uint32 ip) +{ + struct s_subnet lan = {0}; + if (sockt->lan_subnet_check(ip, &lan)) { + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: Matches ""\033[1;36m""%u.%u.%u.%u/%u.%u.%u.%u""\033[0m""\n"), CONVIP(ip), CONVIP(lan.ip & lan.mask), CONVIP(lan.mask))); + return lan.ip; + } + (showmsg->showInfo(("Subnet check [%u.%u.%u.%u]: ""\033[1;36m""WAN""\033[0m""\n"), CONVIP(ip))); + return 0; +} +# 4086 "../../../server-code/src/char/char.c" +void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +{ + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x828; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + + WFIFOL(fd,10) = (int)(delete_date - time( +# 4093 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4093 "../../../server-code/src/char/char.c" + )); + + + + + WFIFOSET(fd,14); +} + +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} +# 4118 "../../../server-code/src/char/char.c" +void char_delete2_accept_ack(int fd, int char_id, uint32 result) +{ + + if( result == 1 ) { + struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; + chr->mmo_char_send099d(fd, sd); + } + + chr->delete2_accept_actual_ack(fd, char_id, result); +} + + + + + +void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} + +static void char_delete2_req(int fd, struct char_session_data* sd) +{ + int char_id, i; + char* data; + time_t delete_date; + + char_id = RFIFOL(fd,2); + do { if (((void)(sd), +# 4149 "../../../server-code/src/char/char.c" 3 4 +0 +# 4149 "../../../server-code/src/char/char.c" +)) return; } while(0); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4151 "../../../server-code/src/char/char.c" 3 4 +0 +# 4151 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4160)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4165 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4165 "../../../server-code/src/char/char.c" + , 10); + + if( delete_date ) { + chr->delete2_ack(fd, char_id, 0, 0); + return; + } + + + + + if (char_aegis_delete) { + int party_id = 0, guild_id = 0; + if( 0 != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || 0 != SQL->NextRow(inter->sql_handle) + ) { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4180)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(inter->sql_handle, 0, &data, +# 4184 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4184 "../../../server-code/src/char/char.c" + ); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, +# 4185 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4185 "../../../server-code/src/char/char.c" + ); guild_id = atoi(data); + + if( guild_id ) + { + chr->delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + chr->delete2_ack(fd, char_id, 5, 0); + return; + } + } + + + delete_date = time( +# 4201 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4201 "../../../server-code/src/char/char.c" + )+char_del_delay; + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4205)); + chr->delete2_ack(fd, char_id, 3, 0); + return; + } + + chr->delete2_ack(fd, char_id, 1, delete_date); +} + +static void char_delete2_accept(int fd, struct char_session_data* sd) +{ + char birthdate[8+1]; + int char_id, i; + unsigned int base_level; + char* data; + time_t delete_date; + + do { if (((void)(sd), +# 4221 "../../../server-code/src/char/char.c" 3 4 +0 +# 4221 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, char_id)); + + + birthdate[0] = RFIFOB(fd,6); + birthdate[1] = RFIFOB(fd,7); + birthdate[2] = '-'; + birthdate[3] = RFIFOB(fd,8); + birthdate[4] = RFIFOB(fd,9); + birthdate[5] = '-'; + birthdate[6] = RFIFOB(fd,10); + birthdate[7] = RFIFOB(fd,11); + birthdate[8] = 0; + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4237 "../../../server-code/src/char/char.c" 3 4 +0 +# 4237 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + if( 0 != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || 0 != SQL->NextRow(inter->sql_handle) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4246)); + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + SQL->GetData(inter->sql_handle, 0, &data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + ); base_level = (unsigned int)strtoul(data, +# 4251 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4251 "../../../server-code/src/char/char.c" + , 10); + SQL->GetData(inter->sql_handle, 1, &data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + ); delete_date = strtoul(data, +# 4252 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4252 "../../../server-code/src/char/char.c" + , 10); + + if( !delete_date || delete_date>time( +# 4254 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4254 "../../../server-code/src/char/char.c" + ) ) + { + chr->delete2_accept_ack(fd, char_id, 4); + return; + } + + if( strcmp(sd->birthdate+2, birthdate) ) + { + chr->delete2_accept_ack(fd, char_id, 5); + return; + } + + if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) + { + chr->delete2_accept_ack(fd, char_id, 2); + return; + } + + + if( chr->delete_char_sql(char_id) < 0 ) + { + chr->delete2_accept_ack(fd, char_id, 3); + return; + } + + + sd->found_char[i] = -1; + + chr->delete2_accept_ack(fd, char_id, 1); +} + +static void char_delete2_cancel(int fd, struct char_session_data* sd) +{ + int char_id, i; + + do { if (((void)(sd), +# 4289 "../../../server-code/src/char/char.c" 3 4 +0 +# 4289 "../../../server-code/src/char/char.c" +)) return; } while(0); + char_id = RFIFOL(fd,2); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == char_id) break; } while( +# 4292 "../../../server-code/src/char/char.c" 3 4 +0 +# 4292 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + + + + if( 0 != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + { + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4304)); + chr->delete2_cancel_ack(fd, char_id, 2); + return; + } + + chr->delete2_cancel_ack(fd, char_id, 1); +} + +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + struct char_auth_node* node; + + RFIFOSKIP(fd,17); + + (showmsg->showInfo(("request connect - account_id:%d/login_id1:%u/login_id2:%u\n"), account_id, login_id1, login_id2)); + + if (sd) { + + + + return; + } + + ((sockt->session[fd]->session_data) = (struct char_session_data *) (iMalloc->calloc(((1)),(sizeof(struct char_session_data)),"../../../server-code/src/char/char.c", 4338, __func__))); + sd = (struct char_session_data*)sockt->session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = +# 4344 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4344 "../../../server-code/src/char/char.c" + ; + + + chr->send_account_id(fd, account_id); + + if( core->runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + + node = (struct char_auth_node*)( DB->data2ptr((auth_db)->get((auth_db),DB->i2key(account_id))) ); + if( node != +# 4356 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4356 "../../../server-code/src/char/char.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 + ) + { + + if( chr->server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + + if( chr->server_type == CST_PAYING && (time_t)node->expiration_time < time( +# 4368 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4368 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + ( (auth_db)->remove((auth_db),DB->i2key(account_id), +# 4372 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4372 "../../../server-code/src/char/char.c" + ) ); + chr->auth_ok(fd, sd); + } + else + { + if (chr->login_fd > 0) { + loginif->auth(fd, sd, ipl); + } else { + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + do { if (((void)(cd), +# 4387 "../../../server-code/src/char/char.c" 3 4 +0 +# 4387 "../../../server-code/src/char/char.c" +)) return; } while(0); + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4391, __func__), WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd,0) = 0x840; + WFIFOW(fd,2) = 24; + (strlib->safestrncpy_((WFIFOP(fd,4)),("0"),(20))); + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + do { if (((void)(cd), +# 4410 "../../../server-code/src/char/char.c" 3 4 +0 +# 4410 "../../../server-code/src/char/char.c" +)) return(-1); } while(0); + if ((i = chr->search_mapserver((j=mapindex->name2id("prontera")),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("geffen")),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("morocc")),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("alberta")),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("payon")),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id("izlude")),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + (showmsg->showWarning(("Unable to find map-server for '%s', sending to major city '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4433, __func__), mapindex->id2name((j),"../../../server-code/src/char/char.c", 4433, __func__))); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + struct char_auth_node* node; + char* data; + int char_id; + int server_id = 0; + int i; + int map_fd; + uint32 subnet_map_ip; + int slot = RFIFOB(fd,2); + + RFIFOSKIP(fd,3); + + + if( pincode->enabled ){ + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } + + + do { for ((server_id) = (0); (server_id) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(server_id)) if (chr->server[server_id].fd > 0 && ( (chr->server[server_id].maps)._len_ ) > 0) break; } while( +# 4465 "../../../server-code/src/char/char.c" 3 4 +0 +# 4465 "../../../server-code/src/char/char.c" +); + + + if( server_id == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) { + chr->send_wait_char_server(fd); + return; + } + + if (0 != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || 0 != SQL->NextRow(inter->sql_handle) + || 0 != SQL->GetData(inter->sql_handle, 0, &data, +# 4475 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4475 "../../../server-code/src/char/char.c" + ) + ) { + + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4478)); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); + + + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time( +# 4488 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4488 "../../../server-code/src/char/char.c" + ) ) { + chr->auth_error(fd, 0); + return; + } + + + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, +# 4495 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4495 "../../../server-code/src/char/char.c" + ) ) { + chr->set_char_offline(char_id, sd->account_id); + + chr->auth_error(fd, 0); + return; + } + + + cd = (struct mmo_charstatus *)( DB->data2ptr((chr->char_db_)->get((chr->char_db_),DB->i2key(char_id))) ); + do { if (((void)(cd), +# 4504 "../../../server-code/src/char/char.c" 3 4 +0 +# 4504 "../../../server-code/src/char/char.c" +)) return; } while(0); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[(23 + 1)*2+1]; + + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, (strlib->strnlen_((char_dat.name),((23 + 1))))); + if( (-1) == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 4515)); + } + (showmsg->showInfo(("Selected char: (Account %d: %d - %s)\n"), sd->account_id, slot, char_dat.name)); + + + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + + if (i < 0 || !cd->last_point.map) { + unsigned short j; + + do { for ((j) = (0); (j) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(j)) if (chr->server[j].fd >= 0 && ( (chr->server[j].maps)._len_ ) > 0) break; } while( +# 4526 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4526 "../../../server-code/src/char/char.c" + ); + if (j == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )) { + (showmsg->showInfo(("Connection Closed. No map servers available.\n"))); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + (showmsg->showInfo(("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n"), mapindex->id2name((cd->last_point.map),"../../../server-code/src/char/char.c", 4535, __func__))); + chr->authfail_fd(fd, 1); + return; + } + } + + + + if ((map_fd = chr->server[i].fd) < 1 || sockt->session[map_fd] == +# 4543 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4543 "../../../server-code/src/char/char.c" + ) + { + (showmsg->showError(("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n"), map_fd, i)); + chr->server[i].fd = -1; + memset(&chr->server[i], 0, sizeof(struct mmo_map_server)); + chr->authfail_fd(fd, 1); + return; + } + + subnet_map_ip = chr->lan_subnet_check(ipl); + + chr->send_map_info(fd, i, subnet_map_ip, cd); + + + ((node) = (struct char_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct char_auth_node)),"../../../server-code/src/char/char.c", 4557, __func__))); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + ( (auth_db)->put((auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 4566 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4566 "../../../server-code/src/char/char.c" +) ); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + + + + + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; + case -2: WFIFOB(fd,2) = 0xFF; break; + case -3: WFIFOB(fd,2) = 0x01; break; + case -4: WFIFOB(fd,2) = 0x03; break; + case -5: WFIFOB(fd,2) = 0x02; break; + + default: + (showmsg->showWarning(("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"))); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + int len; + + + WFIFOHEAD(fd,2+150); + WFIFOW(fd,0) = 0x6d; + len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +{ + int result; + if( !char_new ) { + + result = -2; + } else { + + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + + + + } + + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, +# 4624 "../../../server-code/src/char/char.c" 3 4 + 0 +# 4624 "../../../server-code/src/char/char.c" + ); + chr->creation_ok(fd, &char_dat); + + + sd->found_char[char_dat.slot] = result; + } + + RFIFOSKIP(fd,31); + + + +} + + + +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + char email[40]; + int cid = RFIFOL(fd,2); + int i; + + + if (pincode->enabled) { + struct online_char_data* character; + character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } + + (showmsg->showInfo(("\033[1;31m""Request Char Deletion: ""\033[1;32m""%d (%d)""\033[0m""\n"), sd->account_id, cid)); + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + + if (strcasecmp(email, sd->email) != 0 + && ( strcmp("a@a.com", sd->email) != 0 + || (strcmp("a@a.com", email) != 0 && strcmp("", email) != 0) + )) { + + chr->delete_char_failed(fd, 0); + return; + } + + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4687 "../../../server-code/src/char/char.c" 3 4 +0 +# 4687 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + { + chr->delete_char_failed(fd, 0); + return; + } + + + sd->found_char[i] = -1; + + + if(chr->delete_char_sql(cid)<0){ + + + + chr->delete_char_failed(fd, 0); + return; + } + + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + RFIFOSKIP(fd,30); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4731 "../../../server-code/src/char/char.c" 3 4 +0 +# 4731 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[(23 + 1)]; + char esc_name[(23 + 1)*2+1]; + (strlib->safestrncpy_((name),(RFIFOP(fd,10)),((23 + 1)))); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4758 "../../../server-code/src/char/char.c" 3 4 +0 +# 4758 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + + (strlib->normalize_name_((name),("\255\xA0\032\t\x0A\x0D "))); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, (strlib->strnlen_((name),((23 + 1))))); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + (strlib->safestrncpy_((sd->new_name),(name),((23 + 1)))); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + do { for ((i) = (0); (i) < (9); ++(i)) if (sd->found_char[i] == cid) break; } while( +# 4790 "../../../server-code/src/char/char.c" 3 4 +0 +# 4790 "../../../server-code/src/char/char.c" +); + if( i == 9 ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + + + + +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd, uint32 ipl) +{ + char l_user[24], l_pass[24]; + int i; + (strlib->safestrncpy_((l_user),(RFIFOP(fd,2)),(24))); + (strlib->safestrncpy_((l_pass),(RFIFOP(fd,26)),(24))); + + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (chr->server[i].fd <= 0) break; } while( +# 4855 "../../../server-code/src/char/char.c" 3 4 +0 +# 4855 "../../../server-code/src/char/char.c" +); + if (core->runflag != CHARSERVER_ST_RUNNING || + i == ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) || + strcmp(l_user, chr->userid) != 0 || + strcmp(l_pass, chr->passwd) != 0 || + !sockt->allowed_ip_check(ipl)) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + chr->server[i].fd = fd; + chr->server[i].ip = ntohl(RFIFOL(fd,54)); + chr->server[i].port = ntohs(RFIFOW(fd,58)); + chr->server[i].users = 0; + sockt->session[fd]->func_parse = chr->parse_frommap; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, +# 4875 "../../../server-code/src/char/char.c" 3 4 + 1 +# 4875 "../../../server-code/src/char/char.c" + ); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->check(fd, sd); + + RFIFOSKIP(fd, 10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->sendstate(fd, sd, PINCODE_NOTSET); + + RFIFOSKIP(fd, 6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->change(fd, sd); + + RFIFOSKIP(fd, 14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if (RFIFOL(fd,2) == sd->account_id) + pincode->setnew (fd, sd); + RFIFOSKIP(fd, 10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, +# 4921 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 4921 "../../../server-code/src/char/char.c" + ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd,0) = 0x8d5; + WFIFOW(fd,2) = 8; + WFIFOW(fd,4) = ret?0:1; + WFIFOW(fd,6) = 0; + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + +# 4933 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 4933 "../../../server-code/src/char/char.c" + ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + + if( ret ) + + chr->mmo_char_send099d(fd, sd); + + + + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + (showmsg->showError(("chr->parse_char: Received unknown packet ""\033[1;37m""0x%x""\033[0m"" from ip '""\033[1;37m""%s""\033[0m""'! Disconnecting!\n"), RFIFOW(fd,0), sockt->ip2str(ipl, +# 4947 "../../../server-code/src/char/char.c" 3 4 +((void *)0) +# 4947 "../../../server-code/src/char/char.c" +))); + sockt->eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ + unsigned short cmd; + struct char_session_data* sd; + uint32 ipl = sockt->session[fd]->client_addr; + + sd = (struct char_session_data*)sockt->session[fd]->session_data; + + + if(chr->login_fd < 0) + sockt->eof(fd); + + if(sockt->session[fd]->flag.eof) + { + if( sd != +# 4966 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4966 "../../../server-code/src/char/char.c" + && sd->auth ) { + + struct online_char_data* data = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(sd->account_id))) ); + if( data != +# 4969 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4969 "../../../server-code/src/char/char.c" + && data->fd == fd) + data->fd = -1; + if( data == +# 4971 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 4971 "../../../server-code/src/char/char.c" + || data->server == -1) + chr->set_char_offline(-1,sd->account_id); + } + sockt->close(fd); + return 0; + } + + while (RFIFOREST(fd) >= 2) { + cmd = RFIFOW(fd,0); + + + + + if (( (HPM->packets[hpParse_Char])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpParse_Char); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (cmd) { + + + case 0x65: + if( RFIFOREST(fd) < 17 ) + return 0; + { + chr->parse_char_connect(fd, sd, ipl); + } + break; + + + case 0x66: + do { if(RFIFOREST(fd) < (3)) return 0; if (sd== +# 5005 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5005 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(3)); return 0; } } while (0); + { + chr->parse_char_select(fd, sd, ipl); + } + break; + + + + + case 0x970: + { + do { if(RFIFOREST(fd) < (31)) return 0; if (sd== +# 5016 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5016 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(31)); return 0; } } while (0); + + + + + + + + chr->parse_char_create_new_char(fd, sd); + } + break; + + + case 0x68: + + case 0x1fb: + if (cmd == 0x68) do { if(RFIFOREST(fd) < (46)) return 0; if (sd== +# 5032 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5032 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(46)); return 0; } } while (0); + if (cmd == 0x1fb) do { if(RFIFOREST(fd) < (56)) return 0; if (sd== +# 5033 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5033 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(56)); return 0; } } while (0); + { + chr->parse_char_delete_char(fd, sd, cmd); + } + break; + + + + case 0x187: + if (RFIFOREST(fd) < 6) + return 0; + chr->parse_char_ping(fd); + break; + + + case 0x8fc: + do { if(RFIFOREST(fd) < (30)) return 0; if (sd== +# 5049 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5049 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(30)); return 0; } } while (0); + { + chr->parse_char_rename_char(fd, sd); + } + break; + + + + case 0x28d: + do { if(RFIFOREST(fd) < (34)) return 0; if (sd== +# 5058 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5058 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(34)); return 0; } } while (0); + { + chr->parse_char_rename_char2(fd, sd); + } + break; + + + case 0x28f: + + + + + + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5071 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5071 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + { + chr->parse_char_rename_char_confirm(fd, sd); + } + break; + + + + case 0x7e5: + chr->parse_char_request_captcha(fd); + break; + + + + case 0x7e7: + chr->parse_char_check_captcha(fd); + break; + + + case 0x827: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5091 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5091 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_req(fd, sd); + break; + + + case 0x829: + do { if(RFIFOREST(fd) < (12)) return 0; if (sd== +# 5097 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5097 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(12)); return 0; } } while (0); + chr->parse_char_delete2_accept(fd, sd); + break; + + + case 0x82b: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5103 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5103 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_delete2_cancel(fd, sd); + break; + + + case 0x2af8: + if (RFIFOREST(fd) < 60) + return 0; + { + chr->parse_char_login_map_server(fd, ipl); + } + return 0; + + + case 0x8b8: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5118 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5118 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_check(fd, sd); + break; + + + case 0x8c5: + do { if(RFIFOREST(fd) < (6)) return 0; if (sd== +# 5124 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5124 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(6)); return 0; } } while (0); + chr->parse_char_pincode_window(fd, sd); + break; + + + case 0x8be: + do { if(RFIFOREST(fd) < (14)) return 0; if (sd== +# 5130 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5130 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(14)); return 0; } } while (0); + chr->parse_char_pincode_change(fd, sd); + break; + + + case 0x8ba: + do { if(RFIFOREST(fd) < (10)) return 0; if (sd== +# 5136 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5136 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(10)); return 0; } } while (0); + chr->parse_char_pincode_first_pin(fd, sd); + break; + + case 0x9a1: + do { if(RFIFOREST(fd) < (2)) return 0; if (sd== +# 5141 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5141 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(2)); return 0; } } while (0); + chr->parse_char_request_chars(fd, sd); + break; + + + case 0x8d4: + do { if(RFIFOREST(fd) < (8)) return 0; if (sd== +# 5147 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5147 "../../../server-code/src/char/char.c" + || !sd->auth) { RFIFOSKIP(fd,(8)); return 0; } } while (0); + { + chr->parse_char_move_character(fd, sd); + } + break; + + + default: + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; + } + } + + RFIFOFLUSH(fd); + return 0; +} + +int mapif_sendall(const unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5168 "../../../server-code/src/char/char.c" 3 4 +0 +# 5168 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +{ + int i, c; + + do { if (((void)(buf), +# 5187 "../../../server-code/src/char/char.c" 3 4 +0 +# 5187 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + c = 0; + for(i = 0; i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); i++) { + int fd; + if ((fd = chr->server[i].fd) > 0 && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + c++; + } + } + + return c; +} + +int mapif_send(int fd, unsigned char *buf, unsigned int len) +{ + do { if (((void)(buf), +# 5204 "../../../server-code/src/char/char.c" 3 4 +0 +# 5204 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (fd >= 0) { + int i; + do { for ((i) = (0); (i) < (( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) )); ++(i)) if (fd == chr->server[i].fd) break; } while( +# 5207 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5207 "../../../server-code/src/char/char.c" + ); + if( i < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ) ) + { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + return 1; + } + } + return 0; +} + +void mapif_send_users_count(int users) +{ + uint8 buf[6]; + + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); + + + static int prev_users = 0; + if( prev_users == users ) + return 0; + prev_users = users; + + if( chr->login_fd > 0 && sockt->session[chr->login_fd] ) + { + + loginif->send_users_count(users); + } + + mapif->send_users_count(users); + + return 0; +} + + + + + +static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data* character = DB->data2ptr(data); + int* i = +# 5255 "../../../server-code/src/char/char.c" 3 4 + __builtin_va_arg( +# 5255 "../../../server-code/src/char/char.c" + ap +# 5255 "../../../server-code/src/char/char.c" 3 4 + , +# 5255 "../../../server-code/src/char/char.c" + int* +# 5255 "../../../server-code/src/char/char.c" 3 4 + ) +# 5255 "../../../server-code/src/char/char.c" + ; + + do { if (((void)(character), +# 5257 "../../../server-code/src/char/char.c" 3 4 +0 +# 5257 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if(character->server > -1) + { + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; + (*i)++; + return 1; + } + return 0; +} + +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd]) + { + + int users = chr->online_char_db->size(chr->online_char_db); + int i = 0; + + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); + } + return 0; +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && sockt->session[chr->login_fd] != +# 5285 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5285 "../../../server-code/src/char/char.c" + ) + return 0; + + (showmsg->showInfo(("Attempt to connect to login-server...\n"))); + + if ((chr->login_fd = sockt->make_connection(login_ip, login_port, +# 5290 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5290 "../../../server-code/src/char/char.c" + )) == -1) { + chr->login_fd = 0; + return 0; + } + + sockt->session[chr->login_fd]->func_parse = chr->parse_fromlogin; + sockt->session[chr->login_fd]->flag.server = 1; + sockt->realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); + + return 1; +} + + + + + +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + struct online_char_data* character; + if ((character = (struct online_char_data*)( DB->data2ptr((chr->online_char_db)->get((chr->online_char_db),DB->i2key(id))) )) != +# 5310 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5310 "../../../server-code/src/char/char.c" + && character->waiting_disconnect == tid) { + + character->waiting_disconnect = (-1); + chr->set_char_offline(character->char_id, character->account_id); + } + return 0; +} + + + + +static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_char_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 5324 "../../../server-code/src/char/char.c" 3 4 +0 +# 5324 "../../../server-code/src/char/char.c" +)) return(0); } while(0); + if (character->fd != -1) + return 0; + if (character->server == -2) + chr->set_char_offline(character->char_id, character->account_id); + if (character->server < 0) + + ( (chr->online_char_db)->remove((chr->online_char_db),(key), +# 5331 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5331 "../../../server-code/src/char/char.c" + ) ); + return 0; +} + +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); + return 0; +} + +void char_sql_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + + if ((fp = fopen(cfgName, "r")) == +# 5345 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5345 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("File not found: %s\n"), cfgName)); + return; + } + + while(fgets(line, sizeof(line), fp)) + { + if(line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + if(!strcasecmp(w1,"char_db")) + (strlib->safestrncpy_((char_db),(w2),(sizeof(char_db)))); + else if(!strcasecmp(w1,"scdata_db")) + (strlib->safestrncpy_((scdata_db),(w2),(sizeof(scdata_db)))); + else if(!strcasecmp(w1,"cart_db")) + (strlib->safestrncpy_((cart_db),(w2),(sizeof(cart_db)))); + else if(!strcasecmp(w1,"inventory_db")) + (strlib->safestrncpy_((inventory_db),(w2),(sizeof(inventory_db)))); + else if(!strcasecmp(w1,"charlog_db")) + (strlib->safestrncpy_((charlog_db),(w2),(sizeof(charlog_db)))); + else if(!strcasecmp(w1,"storage_db")) + (strlib->safestrncpy_((storage_db),(w2),(sizeof(storage_db)))); + else if(!strcasecmp(w1,"skill_db")) + (strlib->safestrncpy_((skill_db),(w2),(sizeof(skill_db)))); + else if(!strcasecmp(w1,"interlog_db")) + (strlib->safestrncpy_((interlog_db),(w2),(sizeof(interlog_db)))); + else if(!strcasecmp(w1,"memo_db")) + (strlib->safestrncpy_((memo_db),(w2),(sizeof(memo_db)))); + else if(!strcasecmp(w1,"guild_db")) + (strlib->safestrncpy_((guild_db),(w2),(sizeof(guild_db)))); + else if(!strcasecmp(w1,"guild_alliance_db")) + (strlib->safestrncpy_((guild_alliance_db),(w2),(sizeof(guild_alliance_db)))); + else if(!strcasecmp(w1,"guild_castle_db")) + (strlib->safestrncpy_((guild_castle_db),(w2),(sizeof(guild_castle_db)))); + else if(!strcasecmp(w1,"guild_expulsion_db")) + (strlib->safestrncpy_((guild_expulsion_db),(w2),(sizeof(guild_expulsion_db)))); + else if(!strcasecmp(w1,"guild_member_db")) + (strlib->safestrncpy_((guild_member_db),(w2),(sizeof(guild_member_db)))); + else if(!strcasecmp(w1,"guild_skill_db")) + (strlib->safestrncpy_((guild_skill_db),(w2),(sizeof(guild_skill_db)))); + else if(!strcasecmp(w1,"guild_position_db")) + (strlib->safestrncpy_((guild_position_db),(w2),(sizeof(guild_position_db)))); + else if(!strcasecmp(w1,"guild_storage_db")) + (strlib->safestrncpy_((guild_storage_db),(w2),(sizeof(guild_storage_db)))); + else if(!strcasecmp(w1,"party_db")) + (strlib->safestrncpy_((party_db),(w2),(sizeof(party_db)))); + else if(!strcasecmp(w1,"pet_db")) + (strlib->safestrncpy_((pet_db),(w2),(sizeof(pet_db)))); + else if(!strcasecmp(w1,"mail_db")) + (strlib->safestrncpy_((mail_db),(w2),(sizeof(mail_db)))); + else if(!strcasecmp(w1,"auction_db")) + (strlib->safestrncpy_((auction_db),(w2),(sizeof(auction_db)))); + else if(!strcasecmp(w1,"friend_db")) + (strlib->safestrncpy_((friend_db),(w2),(sizeof(friend_db)))); + else if(!strcasecmp(w1,"hotkey_db")) + (strlib->safestrncpy_((hotkey_db),(w2),(sizeof(hotkey_db)))); + else if(!strcasecmp(w1,"quest_db")) + (strlib->safestrncpy_((quest_db),(w2),(sizeof(quest_db)))); + else if(!strcasecmp(w1,"homunculus_db")) + (strlib->safestrncpy_((homunculus_db),(w2),(sizeof(homunculus_db)))); + else if(!strcasecmp(w1,"skill_homunculus_db")) + (strlib->safestrncpy_((skill_homunculus_db),(w2),(sizeof(skill_homunculus_db)))); + else if(!strcasecmp(w1,"mercenary_db")) + (strlib->safestrncpy_((mercenary_db),(w2),(sizeof(mercenary_db)))); + else if(!strcasecmp(w1,"mercenary_owner_db")) + (strlib->safestrncpy_((mercenary_owner_db),(w2),(sizeof(mercenary_owner_db)))); + else if(!strcasecmp(w1,"ragsrvinfo_db")) + (strlib->safestrncpy_((ragsrvinfo_db),(w2),(sizeof(ragsrvinfo_db)))); + else if(!strcasecmp(w1,"elemental_db")) + (strlib->safestrncpy_((elemental_db),(w2),(sizeof(elemental_db)))); + else if(!strcasecmp(w1,"account_data_db")) + (strlib->safestrncpy_((account_data_db),(w2),(sizeof(account_data_db)))); + else if(!strcasecmp(w1,"char_reg_num_db")) + (strlib->safestrncpy_((char_reg_num_db),(w2),(sizeof(char_reg_num_db)))); + else if(!strcasecmp(w1,"char_reg_str_db")) + (strlib->safestrncpy_((char_reg_str_db),(w2),(sizeof(char_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_str_db")) + (strlib->safestrncpy_((acc_reg_str_db),(w2),(sizeof(acc_reg_str_db)))); + else if(!strcasecmp(w1,"acc_reg_num_db")) + (strlib->safestrncpy_((acc_reg_num_db),(w2),(sizeof(acc_reg_num_db)))); + + else if(!strcasecmp(w1,"import")) + chr->sql_config_read(w2); + else + HPM->parseConf(w1, w2, HPCT_CHAR_INTER); + } + fclose(fp); + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); +} + +void char_config_dispatch(char *w1, char *w2) { + +# 5439 "../../../server-code/src/char/char.c" 3 4 +_Bool +# 5439 "../../../server-code/src/char/char.c" + (*dispatch_to[]) (char *w1, char *w2) = { + + pincode->config_read + }; + int i, len = ( (int)(sizeof(dispatch_to)/sizeof((dispatch_to)[0])) ); + for(i = 0; i < len; i++) { + if( (*dispatch_to[i])(w1,w2) ) + break; + } + if (i == len) + HPM->parseConf(w1, w2, HPCT_CHAR); +} + +int char_config_read(const char* cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp = fopen(cfgName, "r"); + + if (fp == +# 5457 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5457 "../../../server-code/src/char/char.c" + ) { + (showmsg->showError(("Configuration file not found: %s.\n"), cfgName)); + return 1; + } + + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) != 2) + continue; + + (strlib->remove_control_chars_(w1)); + (strlib->remove_control_chars_(w2)); + if(strcasecmp(w1,"timestamp_format") == 0) { + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(sizeof(showmsg->timestamp_format)))); + } else if(strcasecmp(w1,"console_silent")==0){ + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } else if(strcasecmp(w1,"stdout_with_ansisequence")==0){ + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 5478 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5478 "../../../server-code/src/char/char.c" + : +# 5478 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5478 "../../../server-code/src/char/char.c" + ; + } else if (strcasecmp(w1, "userid") == 0) { + (strlib->safestrncpy_((chr->userid),(w2),(sizeof(chr->userid)))); + } else if (strcasecmp(w1, "passwd") == 0) { + (strlib->safestrncpy_((chr->passwd),(w2),(sizeof(chr->passwd)))); + } else if (strcasecmp(w1, "server_name") == 0) { + (strlib->safestrncpy_((chr->server_name),(w2),(sizeof(chr->server_name)))); + } else if (strcasecmp(w1, "wisp_server_name") == 0) { + if (strlen(w2) >= 4) { + (strlib->safestrncpy_((wisp_server_name),(w2),(sizeof(wisp_server_name)))); + } + } else if (strcasecmp(w1, "login_ip") == 0) { + login_ip = sockt->host2ip(w2); + if (login_ip) { + char ip_str[16]; + (strlib->safestrncpy_((login_ip_str),(w2),(sizeof(login_ip_str)))); + (showmsg->showStatus(("Login server IP address : %s -> %s\n"), w2, sockt->ip2str(login_ip, ip_str))); + } + } else if (strcasecmp(w1, "login_port") == 0) { + login_port = atoi(w2); + } else if (strcasecmp(w1, "char_ip") == 0) { + chr->ip = sockt->host2ip(w2); + if (chr->ip) { + char ip_str[16]; + (strlib->safestrncpy_((char_ip_str),(w2),(sizeof(char_ip_str)))); + (showmsg->showStatus(("Character server IP address : %s -> %s\n"), w2, sockt->ip2str(chr->ip, ip_str))); + } + } else if (strcasecmp(w1, "bind_ip") == 0) { + bind_ip = sockt->host2ip(w2); + if (bind_ip) { + char ip_str[16]; + (strlib->safestrncpy_((bind_ip_str),(w2),(sizeof(bind_ip_str)))); + (showmsg->showStatus(("Character server binding IP address : %s -> %s\n"), w2, sockt->ip2str(bind_ip, ip_str))); + } + } else if (strcasecmp(w1, "char_port") == 0) { + chr->port = atoi(w2); + } else if (strcasecmp(w1, "char_server_type") == 0) { + chr->server_type = atoi(w2); + } else if (strcasecmp(w1, "char_new") == 0) { + char_new = ( +# 5517 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5517 "../../../server-code/src/char/char.c" + )atoi(w2); + } else if (strcasecmp(w1, "char_new_display") == 0) { + chr->new_display = atoi(w2); + } else if (strcasecmp(w1, "max_connect_user") == 0) { + max_connect_user = atoi(w2); + if (max_connect_user < -1) + max_connect_user = -1; + } else if(strcasecmp(w1, "gm_allow_group") == 0) { + gm_allow_group = atoi(w2); + } else if (strcasecmp(w1, "autosave_time") == 0) { + autosave_interval = atoi(w2) * 1000; + if (autosave_interval <= 0) + autosave_interval = (300*1000); + } else if (strcasecmp(w1, "save_log") == 0) { + save_log = (strlib->config_switch_(w2)); + } + + else if (strcasecmp(w1, "start_point_re") == 0) { + char map[((11 + 1) + 4)]; + int x, y; + if (sscanf(w2, "%15[^,],%d,%d", map, &x, &y) < 3) + continue; + start_point.map = mapindex->name2id(map); + if (!start_point.map) + (showmsg->showError(("Specified start_point_re '%s' not found in map-index cache.\n"), map)); + start_point.x = x; + start_point.y = y; + } +# 5558 "../../../server-code/src/char/char.c" + else if (strcasecmp(w1, "start_items") == 0) { + int i; + char *split; + + i = 0; + split = strtok(w2, ","); + while (split != +# 5564 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5564 "../../../server-code/src/char/char.c" + && i < 32 * 3) { + char *split2 = split; + split = strtok( +# 5566 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5566 "../../../server-code/src/char/char.c" + , ","); + start_items[i] = atoi(split2); + + if (start_items[i] < 0) + start_items[i] = 0; + + ++i; + } + + + if( i%3 ) + { + (showmsg->showWarning(("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"))); + if( i%3 == 1 ) + start_items[i-1] = 0; + else + start_items[i-2] = 0; + } + } else if (strcasecmp(w1, "start_zeny") == 0) { + start_zeny = atoi(w2); + if (start_zeny < 0) + start_zeny = 0; + } else if(strcasecmp(w1,"log_char")==0) { + log_char = atoi(w2); + } else if (strcasecmp(w1, "unknown_char_name") == 0) { + (strlib->safestrncpy_((unknown_char_name),(w2),(sizeof(unknown_char_name)))); + unknown_char_name[(23 + 1)-1] = '\0'; + } else if (strcasecmp(w1, "name_ignoring_case") == 0) { + name_ignoring_case = ( +# 5594 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5594 "../../../server-code/src/char/char.c" + )(strlib->config_switch_(w2)); + } else if (strcasecmp(w1, "char_name_option") == 0) { + char_name_option = atoi(w2); + } else if (strcasecmp(w1, "char_name_letters") == 0) { + (strlib->safestrncpy_((char_name_letters),(w2),(sizeof(char_name_letters)))); + } else if (strcasecmp(w1, "char_del_level") == 0) { + char_del_level = atoi(w2); + } else if (strcasecmp(w1, "char_del_delay") == 0) { + char_del_delay = atoi(w2); + } else if (strcasecmp(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); + } else if(strcasecmp(w1,"db_path")==0) { + (strlib->safestrncpy_((db_path),(w2),(sizeof(db_path)))); + } else if (strcasecmp(w1, "fame_list_alchemist") == 0) { + fame_list_size_chemist = atoi(w2); + if (fame_list_size_chemist > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_alchemist)\n"), 10)); + fame_list_size_chemist = 10; + } + } else if (strcasecmp(w1, "fame_list_blacksmith") == 0) { + fame_list_size_smith = atoi(w2); + if (fame_list_size_smith > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_blacksmith)\n"), 10)); + fame_list_size_smith = 10; + } + } else if (strcasecmp(w1, "fame_list_taekwon") == 0) { + fame_list_size_taekwon = atoi(w2); + if (fame_list_size_taekwon > 10) { + (showmsg->showWarning(("Max fame list size is %d (fame_list_taekwon)\n"), 10)); + fame_list_size_taekwon = 10; + } + } else if (strcasecmp(w1, "guild_exp_rate") == 0) { + guild_exp_rate = atoi(w2); + } else if (strcasecmp(w1, "char_maintenance_min_group_id") == 0) { + char_maintenance_min_group_id = atoi(w2); + } else if (strcasecmp(w1, "import") == 0) { + chr->config_read(w2); + } else + chr->config_dispatch(w1,w2); + } + fclose(fp); + + (showmsg->showInfo(("Done reading %s.\n"), cfgName)); + return 0; +} + +int do_final(void) { + int i; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + chr->set_all_offline(-1); + chr->set_all_offline_sql(); + + inter->final(); + + sockt->flush_fifos(); + + do_final_mapif(); + loginif->final(); + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5658)); + + chr->char_db_->destroy(chr->char_db_, +# 5660 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5660 "../../../server-code/src/char/char.c" + ); + chr->online_char_db->destroy(chr->online_char_db, +# 5661 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5661 "../../../server-code/src/char/char.c" + ); + auth_db->destroy(auth_db, +# 5662 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5662 "../../../server-code/src/char/char.c" + ); + + if( chr->char_fd != -1 ) { + sockt->close(chr->char_fd); + chr->char_fd = -1; + } + + HPM_char_do_final(); + + SQL->Free(inter->sql_handle); + mapindex->final(); + + for (i = 0; i < 2; i++) + do { if (( (chr->server[i].maps)._max_ ) > 0) { (iMalloc->free((( (chr->server[i].maps)._data_ )),"../../../server-code/src/char/char.c", 5675, __func__)); ( (chr->server[i].maps)._data_ ) = +# 5675 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5675 "../../../server-code/src/char/char.c" + ; ( (chr->server[i].maps)._max_ ) = 0; ( (chr->server[i].maps)._len_ ) = 0; } } while( +# 5675 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5675 "../../../server-code/src/char/char.c" + ); + + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5677, __func__)); + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5678, __func__)); + (iMalloc->free((chr->SQL_CONF_NAME),"../../../server-code/src/char/char.c", 5679, __func__)); + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5680, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 5685 "../../../server-code/src/char/char.c" 3 4 + 0 +# 5685 "../../../server-code/src/char/char.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_CHAR; +} + + +void do_shutdown(void) +{ + if( core->runflag != CHARSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = CHARSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(chr->server)/sizeof((chr->server)[0])) ); ++id ) + mapif->server_reset(id); + loginif->check_shutdown(); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 5723 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5723 "../../../server-code/src/char/char.c" + cmdline_arg_charconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->CHAR_CONF_NAME),"../../../server-code/src/char/char.c", 5725, __func__)); + chr->CHAR_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5726, __func__)); + return +# 5727 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5727 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5735 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5735 "../../../server-code/src/char/char.c" + cmdline_arg_interconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->INTER_CONF_NAME),"../../../server-code/src/char/char.c", 5737, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5738, __func__)); + return +# 5739 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5739 "../../../server-code/src/char/char.c" + ; +} + + + + + + +static +# 5747 "../../../server-code/src/char/char.c" 3 4 + _Bool +# 5747 "../../../server-code/src/char/char.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((chr->NET_CONF_NAME),"../../../server-code/src/char/char.c", 5749, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/char/char.c", 5750, __func__)); + return +# 5751 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5751 "../../../server-code/src/char/char.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "char-config", '\0', cmdline_arg_charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "inter-config", '\0', cmdline_arg_interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); +} + +int do_init(int argc, char **argv) { + int i; + memset(&skillid2idx, 0, sizeof(skillid2idx)); + + char_load_defaults(); + + chr->CHAR_CONF_NAME = (iMalloc->astrdup(("conf/char-server.conf"),"../../../server-code/src/char/char.c", 5769, __func__)); + chr->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/char/char.c", 5770, __func__)); + chr->SQL_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5771, __func__)); + chr->INTER_CONF_NAME = (iMalloc->astrdup(("conf/inter-server.conf"),"../../../server-code/src/char/char.c", 5772, __func__)); + + for (i = 0; i < 2; i++) + memset(&(chr->server[i].maps), 0, sizeof(chr->server[i].maps)); + + HPM_char_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + + mapindex->init(); + + + start_point.map = mapindex->name2id("iz_int"); + + + + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + chr->config_read(chr->CHAR_CONF_NAME); + sockt->net_config_read(chr->NET_CONF_NAME); + chr->sql_config_read(chr->SQL_CONF_NAME); + + if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { + (showmsg->showWarning(("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"))); + (showmsg->showNotice(("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"))); + (showmsg->showNotice(("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"))); + } + + inter->init_sql(chr->INTER_CONF_NAME); + + auth_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5804,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + chr->online_char_db = DB->alloc("../../../server-code/src/char/char.c",__func__,5805,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + HPM->event(HPET_INIT); + + chr->mmo_char_sql_init(); + chr->read_fame_list(); + + if ((sockt->naddr_ != 0) && (!login_ip || !chr->ip)) { + char ip_str[16]; + sockt->ip2str(sockt->addr_[0], ip_str); + + if (sockt->naddr_ > 1) + (showmsg->showStatus(("Multiple interfaces detected.. using %s as our IP address\n"), ip_str)); + else + (showmsg->showStatus(("Defaulting to %s as our IP address\n"), ip_str)); + if (!login_ip) { + (strlib->safestrncpy_((login_ip_str),(ip_str),(sizeof(login_ip_str)))); + login_ip = sockt->str2ip(login_ip_str); + } + if (!chr->ip) { + (strlib->safestrncpy_((char_ip_str),(ip_str),(sizeof(char_ip_str)))); + chr->ip = sockt->str2ip(char_ip_str); + } + } + + loginif->init(); + do_init_mapif(); + + + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); + + + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); + + + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); + + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5847)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5851)); + + + if( (-1) == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + (SQL->ShowDebug_((inter->sql_handle), "../../../server-code/src/char/char.c", 5855)); + + sockt->set_defaultparse(chr->parse_char); + + if ((chr->char_fd = sockt->make_listen_bind(bind_ip,chr->port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),chr->port)); + exit( +# 5861 "../../../server-code/src/char/char.c" 3 4 + 1 +# 5861 "../../../server-code/src/char/char.c" + ); + } + + Sql_HerculesUpdateCheck(inter->sql_handle); + + console->input->setSQL(inter->sql_handle); + console->display_gplnotice(); + + (showmsg->showStatus(("The char-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %d).\n\n"), chr->port)); + + if( core->runflag != CORE_ST_STOP ) + { + core->shutdown_callback = do_shutdown; + core->runflag = CHARSERVER_ST_RUNNING; + } + + HPM->event(HPET_READY); + + return 0; +} + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + memset(chr->server, 0, sizeof(chr->server)); + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = +# 5911 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5911 "../../../server-code/src/char/char.c" + ; + chr->char_db_ = +# 5912 "../../../server-code/src/char/char.c" 3 4 + ((void *)0) +# 5912 "../../../server-code/src/char/char.c" + ; + + memset(chr->userid, 0, sizeof(chr->userid)); + memset(chr->passwd, 0, sizeof(chr->passwd)); + memset(chr->server_name, 0, sizeof(chr->server_name)); + + chr->ip = 0; + chr->port = 6121; + chr->server_type = 0; + chr->new_display = 0; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->mmo_gender = char_mmo_gender; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->changecharsex = char_changecharsex; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnet_check = char_lan_subnet_check; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/servergreps/hercules/20150805/src/clif.c b/servergreps/hercules/20150805/src/clif.c new file mode 100644 index 0000000..edff75b --- /dev/null +++ b/servergreps/hercules/20150805/src/clif.c @@ -0,0 +1,47075 @@ +# 1 "../../../server-code/src/map/clif.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/map/clif.c" +# 23 "../../../server-code/src/map/clif.c" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/map/clif.h" 1 +# 24 "../../../server-code/src/map/clif.h" +# 1 "../../../server-code/src/map/map.h" 1 +# 24 "../../../server-code/src/map/map.h" +# 1 "../../../server-code/src/map/atcommand.h" 1 +# 24 "../../../server-code/src/map/atcommand.h" +# 1 "../../../server-code/src/map/pc_groups.h" 1 +# 24 "../../../server-code/src/map/pc_groups.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 24 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/map/pc_groups.h" 2 + + + +# 27 "../../../server-code/src/map/pc_groups.h" +struct DBMap; +struct config_setting_t; + + +enum e_pc_permission { + PC_PERM_NONE = 0, + PC_PERM_TRADE = 0x000001, + PC_PERM_PARTY = 0x000002, + PC_PERM_ALL_SKILL = 0x000004, + PC_PERM_USE_ALL_EQUIPMENT = 0x000008, + PC_PERM_SKILL_UNCONDITIONAL = 0x000010, + PC_PERM_JOIN_ALL_CHAT = 0x000020, + PC_PERM_NO_CHAT_KICK = 0x000040, + PC_PERM_HIDE_SESSION = 0x000080, + PC_PERM_WHO_DISPLAY_AID = 0x000100, + PC_PERM_RECEIVE_HACK_INFO = 0x000200, + PC_PERM_WARP_ANYWHERE = 0x000400, + PC_PERM_VIEW_HPMETER = 0x000800, + PC_PERM_VIEW_EQUIPMENT = 0x001000, + PC_PERM_USE_CHECK = 0x002000, + PC_PERM_USE_CHANGEMAPTYPE = 0x004000, + PC_PERM_USE_ALL_COMMANDS = 0x008000, + PC_PERM_RECEIVE_REQUESTS = 0x010000, + PC_PERM_SHOW_BOSS = 0x020000, + PC_PERM_DISABLE_PVM = 0x040000, + PC_PERM_DISABLE_PVP = 0x080000, + PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, + PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, +}; + + +struct GroupSettings { + unsigned int id; + int level; + char *name; + unsigned int e_permissions; + +# 68 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 68 "../../../server-code/src/map/pc_groups.h" + log_commands; + int index; + + struct config_setting_t *commands; + struct config_setting_t *permissions; + struct config_setting_t *inherit; + +# 74 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 74 "../../../server-code/src/map/pc_groups.h" + inheritance_done; + struct config_setting_t *root; +}; + +typedef struct GroupSettings GroupSettings; + +struct pc_groups_permission_table { + char *name; + unsigned int permission; +}; + + +struct pc_groups_new_permission { + unsigned int pID; + char *name; + unsigned int *mask; +}; + +struct pc_groups_interface { + + struct DBMap *db; + struct DBMap *name_db; + + struct pc_groups_permission_table *permissions; + unsigned char permission_count; + + struct pc_groups_new_permission *HPMpermissions; + unsigned char HPMpermissions_count; + + void (*init) (void); + void (*final) (void); + void (*reload) (void); + + GroupSettings* (*get_dummy_group) (void); + +# 108 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 108 "../../../server-code/src/map/pc_groups.h" + (*exists) (int group_id); + GroupSettings* (*id2group) (int group_id); + +# 110 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/pc_groups.h" + (*has_permission) (GroupSettings *group, unsigned int permission); + +# 111 "../../../server-code/src/map/pc_groups.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/pc_groups.h" + (*should_log_commands) (GroupSettings *group); + const char* (*get_name) (GroupSettings *group); + int (*get_level) (GroupSettings *group); + int (*get_idx) (GroupSettings *group); +}; + + +void pc_groups_defaults(void); + + +extern struct pc_groups_interface *pcg; +# 25 "../../../server-code/src/map/atcommand.h" 2 + +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 27 "../../../server-code/src/map/atcommand.h" 2 + + + + + + +struct map_session_data; +struct AtCommandInfo; +struct block_list; +struct config_setting_t; +# 50 "../../../server-code/src/map/atcommand.h" +typedef enum { + COMMAND_ATCOMMAND = 1, + COMMAND_CHARCOMMAND = 2, +} AtCommandType; + + + + +typedef +# 58 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 58 "../../../server-code/src/map/atcommand.h" + (*AtCommandFunc)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info); +typedef struct AtCommandInfo AtCommandInfo; +typedef struct AliasInfo AliasInfo; + + + + +struct AliasInfo { + AtCommandInfo *command; + char alias[50]; +}; + +struct AtCommandInfo { + char command[50]; + AtCommandFunc func; + char *at_groups; + char *char_groups; + char *help; + +# 76 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 76 "../../../server-code/src/map/atcommand.h" + log; +}; + +struct atcmd_binding_data { + char command[50]; + char npc_event[50]; + int group_lv; + int group_lv_char; + +# 84 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 84 "../../../server-code/src/map/atcommand.h" + log; +}; + + + + +struct atcommand_interface { + unsigned char at_symbol; + unsigned char char_symbol; + + struct atcmd_binding_data** binding; + int binding_count; + + struct DBMap *db; + struct DBMap *alias_db; + + + + + char*** msg_table; + uint8 max_message_table; + + void (*init) ( +# 106 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 106 "../../../server-code/src/map/atcommand.h" + minimal); + void (*final) (void); + + +# 109 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 109 "../../../server-code/src/map/atcommand.h" + (*exec) (const int fd, struct map_session_data *sd, const char *message, +# 109 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 109 "../../../server-code/src/map/atcommand.h" + player_invoked); + +# 110 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 110 "../../../server-code/src/map/atcommand.h" + (*create) (char *name, AtCommandFunc func); + +# 111 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 111 "../../../server-code/src/map/atcommand.h" + (*can_use) (struct map_session_data *sd, const char *command); + +# 112 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 112 "../../../server-code/src/map/atcommand.h" + (*can_use2) (struct map_session_data *sd, const char *command, AtCommandType type); + void (*load_groups) (GroupSettings **groups, struct config_setting_t **commands_, size_t sz); + AtCommandInfo* (*exists) (const char* name); + +# 115 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 115 "../../../server-code/src/map/atcommand.h" + (*msg_read) (const char *cfg_name, +# 115 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 115 "../../../server-code/src/map/atcommand.h" + allow_override); + void (*final_msg) (void); + + struct atcmd_binding_data* (*get_bind_byname) (const char* name); + + AtCommandInfo* (*get_info_byname) (const char *name); + const char* (*check_alias) (const char *aliasname); + void (*get_suggestions) (struct map_session_data* sd, const char *name, +# 122 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 122 "../../../server-code/src/map/atcommand.h" + is_atcmd_cmd); + void (*config_read) (const char* config_filename); + + int (*stopattack) (struct block_list *bl,va_list ap); + int (*pvpoff_sub) (struct block_list *bl,va_list ap); + int (*pvpon_sub) (struct block_list *bl,va_list ap); + int (*atkillmonster_sub) (struct block_list *bl, va_list ap); + void (*raise_sub) (struct map_session_data* sd); + void (*get_jail_time) (int jailtime, int* year, int* month, int* day, int* hour, int* minute); + int (*cleanfloor_sub) (struct block_list *bl, va_list ap); + int (*mutearea_sub) (struct block_list *bl,va_list ap); + void (*getring) (struct map_session_data* sd); + void (*channel_help) (int fd, const char *command, +# 134 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 134 "../../../server-code/src/map/atcommand.h" + can_create); + + void (*commands_sub) (struct map_session_data* sd, const int fd, AtCommandType type); + void (*cmd_db_clear) (void); + int (*cmd_db_clear_sub) (union DBKey key, struct DBData *data, va_list args); + void (*doload) (void); + void (*base_commands) (void); + +# 141 "../../../server-code/src/map/atcommand.h" 3 4 +_Bool +# 141 "../../../server-code/src/map/atcommand.h" + (*add) (char *name, AtCommandFunc func, +# 141 "../../../server-code/src/map/atcommand.h" 3 4 + _Bool +# 141 "../../../server-code/src/map/atcommand.h" + replace); + const char* (*msg) (int msg_number); + void (*expand_message_table) (void); + const char* (*msgfd) (int fd, int msg_number); + const char* (*msgsd) (struct map_session_data *sd, int msg_number); +}; + + +void atcommand_defaults(void); + + +extern struct atcommand_interface *atcommand; +# 25 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/core.h" 1 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 27 "../../../server-code/src/map/map.h" 2 + +# 1 "../../../server-code/src/common/mapindex.h" 1 +# 25 "../../../server-code/src/common/mapindex.h" +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 26 "../../../server-code/src/common/mapindex.h" 2 + + +struct DBMap; +# 84 "../../../server-code/src/common/mapindex.h" +struct mapindex_interface { + char config_file[80]; + + struct DBMap *db; + + int num; + + char *default_map; + + int default_x; + + int default_y; + + struct { + char name[(11 + 1)]; + } list[2000]; + + int (*init) (void); + void (*final) (void); + + int (*addmap) (int index, const char* name); + void (*removemap) (int index); + const char* (*getmapname) (const char* string, char* output); + + + const char* (*getmapname_ext) (const char* string, char* output); + + unsigned short (*name2id) (const char*); + const char * (*id2name) (uint16 id, const char *file, int line, const char *func); + +# 113 "../../../server-code/src/common/mapindex.h" 3 4 +_Bool +# 113 "../../../server-code/src/common/mapindex.h" + (*check_default) (void); +}; + + +void mapindex_defaults(void); + + +extern struct mapindex_interface *mapindex; +# 29 "../../../server-code/src/map/map.h" 2 + + +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 32 "../../../server-code/src/map/map.h" 2 + + + + +# 35 "../../../server-code/src/map/map.h" +struct Sql; +struct mob_data; +struct npc_data; +struct channel_data; +struct hplugin_data_store; + +enum E_MAPSERVER_ST { + MAPSERVER_ST_RUNNING = CORE_ST_LAST, + MAPSERVER_ST_SHUTDOWN, + MAPSERVER_ST_LAST +}; +# 74 "../../../server-code/src/map/map.h" +enum { + + MAPID_NOVICE = 0x0, + MAPID_SWORDMAN, + MAPID_MAGE, + MAPID_ARCHER, + MAPID_ACOLYTE, + MAPID_MERCHANT, + MAPID_THIEF, + MAPID_TAEKWON, + MAPID_WEDDING, + MAPID_GUNSLINGER, + MAPID_NINJA, + MAPID_XMAS, + MAPID_SUMMER, + MAPID_GANGSI, + + MAPID_SUPER_NOVICE = 0x100|0x0, + MAPID_KNIGHT, + MAPID_WIZARD, + MAPID_HUNTER, + MAPID_PRIEST, + MAPID_BLACKSMITH, + MAPID_ASSASSIN, + MAPID_STAR_GLADIATOR, + MAPID_REBELLION = 0x100|0x09, + MAPID_KAGEROUOBORO = 0x100|0x0A, + MAPID_DEATH_KNIGHT = 0x100|0x0E, + + MAPID_CRUSADER = 0x200|0x1, + MAPID_SAGE, + MAPID_BARDDANCER, + MAPID_MONK, + MAPID_ALCHEMIST, + MAPID_ROGUE, + MAPID_SOUL_LINKER, + MAPID_DARK_COLLECTOR = 0x200|0x0E, + + MAPID_NOVICE_HIGH = 0x1000|0x0, + MAPID_SWORDMAN_HIGH, + MAPID_MAGE_HIGH, + MAPID_ARCHER_HIGH, + MAPID_ACOLYTE_HIGH, + MAPID_MERCHANT_HIGH, + MAPID_THIEF_HIGH, + + MAPID_LORD_KNIGHT = 0x1000|0x100|0x1, + MAPID_HIGH_WIZARD, + MAPID_SNIPER, + MAPID_HIGH_PRIEST, + MAPID_WHITESMITH, + MAPID_ASSASSIN_CROSS, + + MAPID_PALADIN = 0x1000|0x200|0x1, + MAPID_PROFESSOR, + MAPID_CLOWNGYPSY, + MAPID_CHAMPION, + MAPID_CREATOR, + MAPID_STALKER, + + MAPID_BABY = 0x2000|0x0, + MAPID_BABY_SWORDMAN, + MAPID_BABY_MAGE, + MAPID_BABY_ARCHER, + MAPID_BABY_ACOLYTE, + MAPID_BABY_MERCHANT, + MAPID_BABY_THIEF, + + MAPID_SUPER_BABY = 0x2000|0x100|0x0, + MAPID_BABY_KNIGHT, + MAPID_BABY_WIZARD, + MAPID_BABY_HUNTER, + MAPID_BABY_PRIEST, + MAPID_BABY_BLACKSMITH, + MAPID_BABY_ASSASSIN, + + MAPID_BABY_CRUSADER = 0x2000|0x200|0x1, + MAPID_BABY_SAGE, + MAPID_BABY_BARDDANCER, + MAPID_BABY_MONK, + MAPID_BABY_ALCHEMIST, + MAPID_BABY_ROGUE, + + MAPID_SUPER_NOVICE_E = 0x4000|0x100|0x0, + MAPID_RUNE_KNIGHT, + MAPID_WARLOCK, + MAPID_RANGER, + MAPID_ARCH_BISHOP, + MAPID_MECHANIC, + MAPID_GUILLOTINE_CROSS, + + MAPID_ROYAL_GUARD = 0x4000|0x200|0x1, + MAPID_SORCERER, + MAPID_MINSTRELWANDERER, + MAPID_SURA, + MAPID_GENETIC, + MAPID_SHADOW_CHASER, + + MAPID_RUNE_KNIGHT_T = 0x4000|0x1000|0x100|0x1, + MAPID_WARLOCK_T, + MAPID_RANGER_T, + MAPID_ARCH_BISHOP_T, + MAPID_MECHANIC_T, + MAPID_GUILLOTINE_CROSS_T, + + MAPID_ROYAL_GUARD_T = 0x4000|0x1000|0x200|0x1, + MAPID_SORCERER_T, + MAPID_MINSTRELWANDERER_T, + MAPID_SURA_T, + MAPID_GENETIC_T, + MAPID_SHADOW_CHASER_T, + + MAPID_SUPER_BABY_E = 0x4000|0x2000|0x100|0x0, + MAPID_BABY_RUNE, + MAPID_BABY_WARLOCK, + MAPID_BABY_RANGER, + MAPID_BABY_BISHOP, + MAPID_BABY_MECHANIC, + MAPID_BABY_CROSS, + + MAPID_BABY_GUARD = 0x4000|0x2000|0x200|0x1, + MAPID_BABY_SORCERER, + MAPID_BABY_MINSTRELWANDERER, + MAPID_BABY_SURA, + MAPID_BABY_GENETIC, + MAPID_BABY_CHASER, +}; +# 233 "../../../server-code/src/map/map.h" +enum bl_type { + BL_NUL = 0x000, + BL_PC = 0x001, + BL_MOB = 0x002, + BL_PET = 0x004, + BL_HOM = 0x008, + BL_MER = 0x010, + BL_ITEM = 0x020, + BL_SKILL = 0x040, + BL_NPC = 0x080, + BL_CHAT = 0x100, + BL_ELEM = 0x200, + + BL_ALL = 0xFFF, +}; + + + + +enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; + + + + + + +enum Race { + + RC_FORMLESS = 0, + RC_UNDEAD, + RC_BRUTE, + RC_PLANT, + RC_INSECT, + RC_FISH, + RC_DEMON, + RC_DEMIHUMAN, + RC_ANGEL, + RC_DRAGON, + RC_PLAYER, + + RC_BOSS, + RC_NONBOSS, + + RC_MAX, + + + RC_NONDEMIHUMAN, + RC_NONPLAYER, + RC_DEMIPLAYER, + RC_NONDEMIPLAYER, + RC_ALL = 0xFF, +}; + + + + + + +enum RaceMask { + RCMASK_NONE = 0, + RCMASK_FORMLESS = 1<lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 68 "../../../server-code/src/common/HPM.h" + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 57 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/conf.h" 1 +# 26 "../../../server-code/src/common/conf.h" +# 1 "../../../server-code/3rdparty/libconfig/libconfig.h" 1 +# 70 "../../../server-code/3rdparty/libconfig/libconfig.h" +union config_value_t +{ + int ival; + long long llval; + double fval; + char *sval; + struct config_list_t *list; +}; + +struct config_setting_t +{ + char *name; + short type; + short format; + union config_value_t value; + struct config_setting_t *parent; + struct config_t *config; + void *hook; + unsigned int line; + const char *file; +}; + +enum config_error_t +{ + CONFIG_ERR_NONE = 0, + CONFIG_ERR_FILE_IO = 1, + CONFIG_ERR_PARSE = 2 +}; + +struct config_list_t +{ + unsigned int length; + struct config_setting_t **elements; +}; + +struct config_t +{ + struct config_setting_t *root; + void (*destructor)(void *); + int options; + unsigned short tab_width; + short default_format; + char *include_dir; + const char *error_text; + const char *error_file; + int error_line; + enum config_error_t error_type; + char **filenames; + unsigned int num_filenames; +}; + +extern int config_read(struct config_t *config, FILE *stream); +extern void config_write(const struct config_t *config, FILE *stream); + +extern void config_set_default_format(struct config_t *config, + short format); + +extern void config_set_options(struct config_t *config, int options); +extern int config_get_options(const struct config_t *config); + +extern void config_set_auto_convert(struct config_t *config, int flag); +extern int config_get_auto_convert(const struct config_t *config); + +extern int config_read_string(struct config_t *config, const char *str); + +extern int config_read_file(struct config_t *config, + const char *filename); +extern int config_write_file(struct config_t *config, + const char *filename); + +extern void config_set_destructor(struct config_t *config, + void (*destructor)(void *)); +extern void config_set_include_dir(struct config_t *config, + const char *include_dir); + +extern void config_init(struct config_t *config); +extern void config_destroy(struct config_t *config); + +extern int config_setting_get_int( + const struct config_setting_t *setting); +extern long long config_setting_get_int64( + const struct config_setting_t *setting); +extern double config_setting_get_float( + const struct config_setting_t *setting); +extern int config_setting_get_bool( + const struct config_setting_t *setting); +extern const char *config_setting_get_string( + const struct config_setting_t *setting); + +extern int config_setting_lookup_int( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_int64( + const struct config_setting_t *setting, const char *name, long long *value); +extern int config_setting_lookup_float( + const struct config_setting_t *setting, const char *name, double *value); +extern int config_setting_lookup_bool( + const struct config_setting_t *setting, const char *name, int *value); +extern int config_setting_lookup_string( + const struct config_setting_t *setting, const char *name, const char **value); + +extern int config_setting_set_int(struct config_setting_t *setting, + int value); +extern int config_setting_set_int64(struct config_setting_t *setting, + long long value); +extern int config_setting_set_float(struct config_setting_t *setting, + double value); +extern int config_setting_set_bool(struct config_setting_t *setting, + int value); +extern int config_setting_set_string(struct config_setting_t *setting, + const char *value); + +extern int config_setting_set_format(struct config_setting_t *setting, + short format); +extern short config_setting_get_format( + const struct config_setting_t *setting); + +extern int config_setting_get_int_elem( + const struct config_setting_t *setting, int idx); +extern long long config_setting_get_int64_elem( + const struct config_setting_t *setting, int idx); +extern double config_setting_get_float_elem( + const struct config_setting_t *setting, int idx); +extern int config_setting_get_bool_elem( + const struct config_setting_t *setting, int idx); +extern const char *config_setting_get_string_elem( + const struct config_setting_t *setting, int idx); + +extern struct config_setting_t *config_setting_set_int_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_int64_elem( + struct config_setting_t *setting, int idx, long long value); +extern struct config_setting_t *config_setting_set_float_elem( + struct config_setting_t *setting, int idx, double value); +extern struct config_setting_t *config_setting_set_bool_elem( + struct config_setting_t *setting, int idx, int value); +extern struct config_setting_t *config_setting_set_string_elem( + struct config_setting_t *setting, int idx, const char *value); +# 247 "../../../server-code/3rdparty/libconfig/libconfig.h" +extern int config_setting_index(const struct config_setting_t *setting); + +extern int config_setting_length( + const struct config_setting_t *setting); +extern struct config_setting_t *config_setting_get_elem( + const struct config_setting_t *setting, unsigned int idx); + +extern struct config_setting_t *config_setting_get_member( + const struct config_setting_t *setting, const char *name); + +extern struct config_setting_t *config_setting_add( + struct config_setting_t *parent, const char *name, int type); +extern int config_setting_remove(struct config_setting_t *parent, + const char *name); +extern int config_setting_remove_elem(struct config_setting_t *parent, + unsigned int idx); +extern void config_setting_set_hook(struct config_setting_t *setting, + void *hook); + + + +extern struct config_setting_t *config_lookup(const struct config_t *config, + const char *path); +extern struct config_setting_t *config_setting_lookup( + struct config_setting_t *setting, const char *path); + +extern int config_lookup_int(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_int64(const struct config_t *config, + const char *path, + long long *value); +extern int config_lookup_float(const struct config_t *config, + const char *path, double *value); +extern int config_lookup_bool(const struct config_t *config, + const char *path, int *value); +extern int config_lookup_string(const struct config_t *config, + const char *path, + const char **value); +# 27 "../../../server-code/src/common/conf.h" 2 + + + + +struct libconfig_interface { + int (*read) (struct config_t *config, FILE *stream); + void (*write) (const struct config_t *config, FILE *stream); + + void (*set_options) (struct config_t *config, int options); + int (*get_options) (const struct config_t *config); + + int (*read_string) (struct config_t *config, const char *str); + int (*read_file_src) (struct config_t *config, const char *filename); + int (*write_file) (struct config_t *config, const char *filename); + + void (*set_destructor) (struct config_t *config, void (*destructor)(void *)); + void (*set_include_dir) (struct config_t *config, const char *include_dir); + + void (*init) (struct config_t *config); + void (*destroy) (struct config_t *config); + + int (*setting_get_int) (const struct config_setting_t *setting); + long long (*setting_get_int64) (const struct config_setting_t *setting); + double (*setting_get_float) (const struct config_setting_t *setting); + + int (*setting_get_bool) (const struct config_setting_t *setting); + + const char * (*setting_get_string) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name); + int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value); + int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value); + int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value); + int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value); + int (*setting_set_int) (struct config_setting_t *setting ,int value); + int (*setting_set_int64) (struct config_setting_t *setting, long long value); + int (*setting_set_float) (struct config_setting_t *setting, double value); + int (*setting_set_bool) (struct config_setting_t *setting, int value); + int (*setting_set_string) (struct config_setting_t *setting, const char *value); + + int (*setting_set_format) (struct config_setting_t *setting, short format); + short (*setting_get_format) (const struct config_setting_t *setting); + + int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx); + long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx); + double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx); + int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx); + const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx); + struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value); + struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value); + struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value); + struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value); + + int (*setting_index) (const struct config_setting_t *setting); + int (*setting_length) (const struct config_setting_t *setting); + + struct config_setting_t * (*setting_get_elem) (const struct config_setting_t *setting, unsigned int idx); + struct config_setting_t * (*setting_get_member) (const struct config_setting_t *setting, const char *name); + + struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type); + int (*setting_remove) (struct config_setting_t *parent, const char *name); + + int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx); + void (*setting_set_hook) (struct config_setting_t *setting, void *hook); + + struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath); + int (*lookup_int) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value); + int (*lookup_float) (const struct config_t *config, const char *filepath, double *value); + int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value); + int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value); + + + + int (*load_file) (struct config_t *config, const char *config_filename); + void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src); + void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src); + int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src); + + +# 109 "../../../server-code/src/common/conf.h" 3 4 +_Bool +# 109 "../../../server-code/src/common/conf.h" + (*setting_get_bool_real) (const struct config_setting_t *setting); + uint32 (*setting_get_uint32) (const struct config_setting_t *setting); + uint16 (*setting_get_uint16) (const struct config_setting_t *setting); + int16 (*setting_get_int16) (const struct config_setting_t *setting); + + int (*setting_lookup_bool_real) (const struct config_setting_t *setting, const char *name, +# 114 "../../../server-code/src/common/conf.h" 3 4 + _Bool +# 114 "../../../server-code/src/common/conf.h" + *value); + int (*setting_lookup_uint32) (const struct config_setting_t *setting, const char *name, uint32 *value); + int (*setting_lookup_uint16) (const struct config_setting_t *setting, const char *name, uint16 *value); + int (*setting_lookup_int16) (const struct config_setting_t *setting, const char *name, int16 *value); + int (*setting_lookup_mutable_string) (const struct config_setting_t *setting, const char *name, char *out, size_t out_size); + int (*lookup_mutable_string) (const struct config_t *config, const char *name, char *out, size_t out_size); +}; + + +void libconfig_defaults(void); + + +extern struct libconfig_interface *libconfig; +# 59 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/grfio.h" 1 +# 25 "../../../server-code/src/common/grfio.h" +void grfio_init(const char* fname); +void grfio_final(void); +void* grfio_reads(const char* fname, int* size); +char* grfio_find_file(const char* fname); + + +unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); +int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); +# 61 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 62 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 64 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 65 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 67 "../../../server-code/src/map/clif.c" 2 + +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 69 "../../../server-code/src/map/clif.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 28 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 +# 258 "/usr/include/unistd.h" 3 4 + +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 70 "../../../server-code/src/map/clif.c" 2 + + + + + + + +struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[0x0F00 + 1]; + + +static struct packet_itemlist_normal itemlist_normal; +static struct packet_itemlist_equip itemlist_equip; +static struct packet_storelist_normal storelist_normal; +static struct packet_storelist_equip storelist_equip; +static struct packet_viewequip_ack viewequip_list; + +static struct packet_npc_market_result_ack npcmarket_result; +static struct packet_npc_market_open npcmarket_open; + + + + + +static inline int itemtype(int type) { + switch( type ) { + + case IT_WEAPON: + return IT_ARMOR; + case IT_ARMOR: + case IT_PETARMOR: + + case IT_PETEGG: + return IT_WEAPON; + default: + return type; + } +} + +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)); + p[2] = (uint8)((y<<4) | (dir&0xf)); +} + + +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)); + p[2] = (uint8)((y0<<4) | ((x1>>6)&0x0f)); + p[3] = (uint8)((x1<<2) | ((y1>>8)&0x03)); + p[4] = (uint8)y1; + p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); +} + + + + + + + +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) { + p += pos; + + if( x ) { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) { + dir[0] = ( p[2] & 0x0f ); + } +} + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} +# 193 "../../../server-code/src/map/clif.c" +static inline +# 193 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 193 "../../../server-code/src/map/clif.c" + disguised(struct block_list* bl) +{ + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 195 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 195 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + if (sd == +# 196 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 196 "../../../server-code/src/map/clif.c" + || sd->disguise == -1) + return +# 197 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 197 "../../../server-code/src/map/clif.c" + ; + return +# 198 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 198 "../../../server-code/src/map/clif.c" + ; +} + + + + + +# 204 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 204 "../../../server-code/src/map/clif.c" + clif_setip(const char* ip) { + char ip_str[16]; + do { if (((void)(ip), +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +)) return( +# 206 "../../../server-code/src/map/clif.c" 3 4 +0 +# 206 "../../../server-code/src/map/clif.c" +); } while(0); + clif->map_ip = sockt->host2ip(ip); + if ( !clif->map_ip ) { + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 210 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 210 "../../../server-code/src/map/clif.c" + ; + } + + (strlib->safestrncpy_((clif->map_ip_str),(ip),(sizeof(clif->map_ip_str)))); + (showmsg->showInfo(("Map Server IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->map_ip, ip_str))); + return +# 215 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 215 "../../../server-code/src/map/clif.c" + ; +} + + +# 218 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 218 "../../../server-code/src/map/clif.c" + clif_setbindip(const char* ip) { + do { if (((void)(ip), +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +)) return( +# 219 "../../../server-code/src/map/clif.c" 3 4 +0 +# 219 "../../../server-code/src/map/clif.c" +); } while(0); + clif->bind_ip = sockt->host2ip(ip); + if ( clif->bind_ip ) { + char ip_str[16]; + (showmsg->showInfo(("Map Server Bind IP Address : '""\033[1;37m""%s""\033[0m""' -> '""\033[1;37m""%s""\033[0m""'.\n"), ip, sockt->ip2str(clif->bind_ip, ip_str))); + return +# 224 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 224 "../../../server-code/src/map/clif.c" + ; + } + (showmsg->showWarning(("Failed to Resolve Map Server Address! (%s)\n"), ip)); + return +# 227 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 227 "../../../server-code/src/map/clif.c" + ; +} + + + + + +void clif_setport(uint16 port) +{ + clif->map_port = port; +} + + + + +uint32 clif_getip(void) +{ + return clif->map_ip; +} + + + + +uint16 clif_getport(void) +{ + return clif->map_port; +} + + + +uint32 clif_refresh_ip(void) +{ + uint32 new_ip = sockt->host2ip(clif->map_ip_str); + if ( new_ip && new_ip != clif->map_ip ) { + clif->map_ip = new_ip; + (showmsg->showInfo(("Updating IP resolution of [%s].\n"), clif->map_ip_str)); + return clif->map_ip; + } + return 0; +} + + +static inline unsigned char clif_bl_type(struct block_list *bl) { + do { if (((void)(bl), +# 270 "../../../server-code/src/map/clif.c" 3 4 +0 +# 270 "../../../server-code/src/map/clif.c" +)) return(0x1); } while(0); + switch (bl->type) { + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; + case BL_ITEM: return 0x2; + case BL_SKILL: return 0x3; + case BL_CHAT: return 0x4; + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; + case BL_HOM: return 0x8; + case BL_MER: return 0x9; + case BL_ELEM: return 0xa; + default: return 0x1; + } +} +# 297 "../../../server-code/src/map/clif.c" +int clif_send_sub(struct block_list *bl, va_list ap) { + struct block_list *src_bl; + struct map_session_data *sd; + void *buf; + int len, type, fd; + + do { if (((void)(bl), +# 303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 303 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (( (bl->type == BL_PC) ? +# 304 "../../../server-code/src/map/clif.c" 3 4 +0 +# 304 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 304, __func__, "bl->type == BL_PC", "failed assertion"), +# 304 "../../../server-code/src/map/clif.c" 3 4 +1 +# 304 "../../../server-code/src/map/clif.c" +) )) return(0); } while(0); + sd = ((TBL_PC *)BL_UCAST_(bl)); + + fd = sd->fd; + if (!fd || sockt->session[fd] == +# 308 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 308 "../../../server-code/src/map/clif.c" + ) + return 0; + + buf = +# 311 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 311 "../../../server-code/src/map/clif.c" + ap +# 311 "../../../server-code/src/map/clif.c" 3 4 + , +# 311 "../../../server-code/src/map/clif.c" + void* +# 311 "../../../server-code/src/map/clif.c" 3 4 + ) +# 311 "../../../server-code/src/map/clif.c" + ; + len = +# 312 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 312 "../../../server-code/src/map/clif.c" + ap +# 312 "../../../server-code/src/map/clif.c" 3 4 + , +# 312 "../../../server-code/src/map/clif.c" + int +# 312 "../../../server-code/src/map/clif.c" 3 4 + ) +# 312 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(src_bl = +# 313 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_arg( +# 313 "../../../server-code/src/map/clif.c" +ap +# 313 "../../../server-code/src/map/clif.c" 3 4 +, +# 313 "../../../server-code/src/map/clif.c" +struct block_list* +# 313 "../../../server-code/src/map/clif.c" 3 4 +) +# 313 "../../../server-code/src/map/clif.c" +), +# 313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 313 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + type = +# 314 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 314 "../../../server-code/src/map/clif.c" + ap +# 314 "../../../server-code/src/map/clif.c" 3 4 + , +# 314 "../../../server-code/src/map/clif.c" + int +# 314 "../../../server-code/src/map/clif.c" 3 4 + ) +# 314 "../../../server-code/src/map/clif.c" + ; + + switch(type) { + case AREA_WOS: + if (bl == src_bl) + return 0; + break; + case AREA_WOC: + if (sd->chatID || bl == src_bl) + return 0; + break; + case AREA_WOSC: { + if (src_bl->type == BL_PC) { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(src_bl)); + if (ssd != +# 328 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 328 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == ssd->chatID)) + return 0; + } else if (src_bl->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(src_bl)); + if (nd != +# 332 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 332 "../../../server-code/src/map/clif.c" + && sd->chatID != 0 && (sd->chatID == nd->chat_id)) + return 0; + } + } + break; + + + + + + + + } + + + if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) + return 0; + + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ + do { if (((void)(buf), +# 355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 355 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + WFIFOHEAD(fd, len); + if (WFIFOP(fd,0) == buf) { + (showmsg->showError(("WARNING: Invalid use of clif->send function\n"))); + (showmsg->showError((" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n"), WBUFW(buf,0))); + (showmsg->showError((" Please correct your code.\n"))); + + + + return 0; + } + + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + + return 0; +} + + + + + + +# 377 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 377 "../../../server-code/src/map/clif.c" + clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { + int i; + struct map_session_data *sd, *tsd; + struct party_data *p = +# 380 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 380 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 381 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 381 "../../../server-code/src/map/clif.c" + ; + struct battleground_data *bgd = +# 382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 382 "../../../server-code/src/map/clif.c" + ; + int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; + struct s_mapiterator* iter; + + if( type != ALL_CLIENT ) + do { if (((void)(bl), +# 387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 387 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + + sd = ( ((bl) == (struct block_list *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 389 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 389 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + if (sd != +# 391 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 391 "../../../server-code/src/map/clif.c" + && ( (sd)->sc.option&OPTION_INVISIBLE )) { + if (type == AREA || type == BG || type == BG_AREA) + type = SELF; + else if (type == AREA_WOS || type == BG_WOS || type == BG_AREA_WOS) + return +# 395 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 395 "../../../server-code/src/map/clif.c" + ; + } + + switch(type) { + case ALL_CLIENT: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 401 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 401 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + mapit->free(iter); + break; + + case ALL_SAMEMAP: + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 411 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 411 "../../../server-code/src/map/clif.c" + ) { + if (bl && bl->m == tsd->bl.m) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case AREA: + case AREA_WOSC: + if (sd && bl->prev == +# 423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 423 "../../../server-code/src/map/clif.c" + ) + clif->send (buf, len, bl, SELF); + + case AREA_WOC: + case AREA_WOS: + do { if (((void)(bl), +# 428 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 428 "../../../server-code/src/map/clif.c" + )) return( +# 428 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 428 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-(battle->bc->area_size), bl->y-(battle->bc->area_size), bl->x+(battle->bc->area_size), bl->y+(battle->bc->area_size), + BL_PC, buf, len, bl, type); + break; + case AREA_CHAT_WOC: + do { if (((void)(bl), +# 433 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 433 "../../../server-code/src/map/clif.c" + )) return( +# 433 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 433 "../../../server-code/src/map/clif.c" + ); } while(0); + map->foreachinarea(clif->send_sub, bl->m, bl->x-((battle->bc->area_size)-5), bl->y-((battle->bc->area_size)-5), + bl->x+((battle->bc->area_size)-5), bl->y+((battle->bc->area_size)-5), BL_PC, buf, len, bl, AREA_WOC); + break; + + case CHAT: + case CHAT_WOS: + do { if (((void)(bl), +# 440 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 440 "../../../server-code/src/map/clif.c" + )) return( +# 440 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 440 "../../../server-code/src/map/clif.c" + ); } while(0); + { + const struct chat_data *cd = +# 442 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 442 "../../../server-code/src/map/clif.c" + ; + if (sd != +# 443 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 443 "../../../server-code/src/map/clif.c" + ) { + cd = map->id2cd(sd->chatID); + } else { + cd = ( ((bl) == (const struct block_list *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_CHAT)) ? (const TBL_CHAT *) +# 446 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 446 "../../../server-code/src/map/clif.c" + : (const TBL_CHAT *)(bl) ); + } + if (cd == +# 448 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 448 "../../../server-code/src/map/clif.c" + ) + break; + for(i = 0; i < cd->users; i++) { + if (type == CHAT_WOS && cd->usersd[i] == sd) + continue; + if ((fd=cd->usersd[i]->fd) >0 && sockt->session[fd]) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + } + break; + + case PARTY_AREA: + case PARTY_AREA_WOS: + do { if (((void)(bl), +# 464 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 464 "../../../server-code/src/map/clif.c" + )) return( +# 464 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 464 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case PARTY: + case PARTY_WOS: + case PARTY_SAMEMAP: + case PARTY_SAMEMAP_WOS: + if (sd && sd->status.party_id) + p = party->search(sd->status.party_id); + + if (p) { + for(i=0;i<12;i++){ + if( (sd = p->data[i].sd) == +# 479 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 479 "../../../server-code/src/map/clif.c" + ) + continue; + + if( !(fd=sd->fd) ) + continue; + + if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) + continue; + + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) + continue; + + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 502 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 502 "../../../server-code/src/map/clif.c" + ) { + if( tsd->partyspy == p->party.party_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case DUEL: + case DUEL_WOS: + if (!sd || !sd->duel_group) break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 518 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 518 "../../../server-code/src/map/clif.c" + ) { + if( type == DUEL_WOS && bl->id == tsd->bl.id ) + continue; + if( sd->duel_group == tsd->duel_group ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + break; + + case SELF: + if (sd && (fd=sd->fd) != 0) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + break; + + + case GUILD_AREA: + case GUILD_AREA_WOS: + do { if (((void)(bl), +# 541 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 541 "../../../server-code/src/map/clif.c" + )) return( +# 541 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 541 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case GUILD_SAMEMAP: + case GUILD_SAMEMAP_WOS: + case GUILD: + case GUILD_WOS: + case GUILD_NOBG: + if (sd && sd->status.guild_id) + g = sd->guild; + + if (g) { + for(i = 0; i < g->max_member; i++) { + if( (sd = g->member[i].sd) != +# 557 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/map/clif.c" + ) { + if( !(fd=sd->fd) ) + continue; + + if( type == GUILD_NOBG && sd->bg_id ) + continue; + + if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) + continue; + + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) + continue; + + if( (type == GUILD_AREA || type == GUILD_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + if (!map->enable_spy) + break; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + while ((tsd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) != +# 581 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 581 "../../../server-code/src/map/clif.c" + ) { + if( tsd->guildspy == g->guild_id ) { + WFIFOHEAD(tsd->fd, len); + memcpy(WFIFOP(tsd->fd,0), buf, len); + WFIFOSET(tsd->fd,len); + } + } + mapit->free(iter); + } + break; + + case BG_AREA: + case BG_AREA_WOS: + do { if (((void)(bl), +# 594 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 594 "../../../server-code/src/map/clif.c" + )) return( +# 594 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 594 "../../../server-code/src/map/clif.c" + ); } while(0); + x0 = bl->x - (battle->bc->area_size); + y0 = bl->y - (battle->bc->area_size); + x1 = bl->x + (battle->bc->area_size); + y1 = bl->y + (battle->bc->area_size); + + case BG_SAMEMAP: + case BG_SAMEMAP_WOS: + case BG: + case BG_WOS: + if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != +# 604 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 604 "../../../server-code/src/map/clif.c" + ) { + for( i = 0; i < 30; i++ ) { + if( (sd = bgd->members[i].sd) == +# 606 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 606 "../../../server-code/src/map/clif.c" + || !(fd = sd->fd) ) + continue; + if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) ) + continue; + if( type != BG && type != BG_WOS && sd->bl.m != bl->m ) + continue; + if( (type == BG_AREA || type == BG_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) + continue; + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + } + } + break; + + case BG_QUEUE: + if( sd && sd->bg_queue.arena ) { + struct script_queue *queue = script->queue(sd->bg_queue.arena->queue_id); + + for (i = 0; i < ( (queue->entries)._len_ ); i++) { + struct map_session_data *qsd = map->id2sd(( ( (queue->entries)._data_ )[i] )); + + if (qsd != +# 628 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 628 "../../../server-code/src/map/clif.c" + ) { + WFIFOHEAD(qsd->fd,len); + memcpy(WFIFOP(qsd->fd,0), buf, len); + WFIFOSET(qsd->fd,len); + } + } + } + break; + + default: + (showmsg->showError(("clif_send: Unrecognized type %u\n"), type)); + return +# 639 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 639 "../../../server-code/src/map/clif.c" + ; + } + + return +# 642 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 642 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_authok(struct map_session_data *sd) +{ + struct packet_authok p; + + do { if (((void)(sd), +# 652 "../../../server-code/src/map/clif.c" 3 4 +0 +# 652 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = authokType; + p.startTime = (unsigned int)timer->gettick(); + WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); + p.xSize = p.ySize = 5; + + p.font = sd->status.font; + + + p.sex = sd->status.sex; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} +# 674 "../../../server-code/src/map/clif.c" +void clif_authrefuse(int fd, uint8 error_code) +{ + WFIFOHEAD(fd,packet_db[0x74].len); + WFIFOW(fd,0) = 0x74; + WFIFOB(fd,2) = error_code; + WFIFOSET(fd,packet_db[0x74].len); +} +# 715 "../../../server-code/src/map/clif.c" +void clif_authfail_fd(int fd, int type) +{ + if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) + return; + + WFIFOHEAD(fd, packet_db[0x81].len); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0x81].len); + sockt->eof(fd); + +} + + + + + + +void clif_charselectok(int id, uint8 ok) { + struct map_session_data* sd; + int fd; + + if ((sd = map->id2sd(id)) == +# 737 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 737 "../../../server-code/src/map/clif.c" + || !sd->fd) + return; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xb3].len); + WFIFOW(fd,0) = 0xb3; + WFIFOB(fd,2) = ok; + WFIFOSET(fd,packet_db[0xb3].len); +} + + + + +void clif_dropflooritem(struct flooritem_data* fitem) { + struct packet_dropflooritem p; + int view; + + do { if (((void)(fitem), +# 754 "../../../server-code/src/map/clif.c" 3 4 +0 +# 754 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (fitem->item_data.nameid <= 0) + return; + + p.PacketType = dropflooritemType; + p.ITAID = fitem->bl.id; + p.ITID = ((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) ? view : fitem->item_data.nameid; + + p.type = itemtype((itemdb->search(fitem->item_data.nameid)->type)); + + p.IsIdentified = fitem->item_data.identify ? 1 : 0; + p.xPos = fitem->bl.x; + p.yPos = fitem->bl.y; + p.subX = fitem->subx; + p.subY = fitem->suby; + p.count = fitem->item_data.amount; + + clif->send(&p, sizeof(p), &fitem->bl, AREA); +} + + + +void clif_clearflooritem(struct flooritem_data *fitem, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(fitem), +# 781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 781 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xa1; + WBUFL(buf,2) = fitem->bl.id; + + if (fd == 0) { + clif->send(buf, packet_db[0xa1].len, &fitem->bl, AREA); + } else { + WFIFOHEAD(fd,packet_db[0xa1].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0xa1].len); + WFIFOSET(fd,packet_db[0xa1].len); + } +} +# 803 "../../../server-code/src/map/clif.c" +void clif_clearunit_single(int id, clr_type type, int fd) +{ + WFIFOHEAD(fd, packet_db[0x80].len); + WFIFOW(fd,0) = 0x80; + WFIFOL(fd,2) = id; + WFIFOB(fd,6) = type; + WFIFOSET(fd, packet_db[0x80].len); +} +# 820 "../../../server-code/src/map/clif.c" +void clif_clearunit_area(struct block_list* bl, clr_type type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 824 "../../../server-code/src/map/clif.c" 3 4 +0 +# 824 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x80; + WBUFL(buf,2) = bl->id; + WBUFB(buf,6) = type; + + clif->send(buf, packet_db[0x80].len, bl, type == CLR_DEAD ? AREA : AREA_WOS); + + if(disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x80].len, bl, SELF); + } +} + + + + +int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { + struct block_list *bl = (struct block_list *)data; + clif->clearunit_area(bl, (clr_type) id); + ((clif->delay_clearunit_ers)->free((clif->delay_clearunit_ers),(bl))); + return 0; +} + +void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { + struct block_list *tbl; + + do { if (((void)(bl), +# 851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + tbl = ((struct block_list *)(clif->delay_clearunit_ers)->alloc(clif->delay_clearunit_ers)); + memcpy (tbl, bl, sizeof (struct block_list)); + timer->add(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) +{ + do { if (((void)(sd), +# 860 "../../../server-code/src/map/clif.c" 3 4 +0 +# 860 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(rhand), +# 861 "../../../server-code/src/map/clif.c" 3 4 +0 +# 861 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(lhand), +# 862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(sd->sc.option&OPTION_COSTUME) { + *rhand = *lhand = 0; + return; + } + + + + + + if (sd->equip_index[EQI_HAND_R] >= 0 && + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + if (id->view_id > 0) + *rhand = id->view_id; + else + *rhand = id->nameid; + } else + *rhand = 0; + + if (sd->equip_index[EQI_HAND_L] >= 0 && + sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + { + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + if (id->view_id > 0) + *lhand = id->view_id; + else + *lhand = id->nameid; + } else + *lhand = 0; + +} + + +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { + ; + } else if( lv < battle_config.aura_lv ) { + lv = battle_config.max_lv - 1; + } else { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) { + int lv = status->get_lv(bl); + do { if (((void)(bl), +# 912 "../../../server-code/src/map/clif.c" 3 4 +0 +# 912 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if( battle_config.client_limit_unit_lv&bl->type ) + return clif_setlevel_sub(lv); + switch( bl->type ) { + case BL_NPC: + case BL_PET: + + return 0; + } + return lv; +} + +void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +# 972 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_idle_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 985 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 994 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 994 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 994 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = idle_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1010 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.state = vd->dead_sit; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1049 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1049 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + p.body = vd->body_style; + (strlib->safestrncpy_((p.name),(clif->get_bl_name(bl)),((23 + 1)))); + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } + +} + +void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +# 1117 "../../../server-code/src/map/clif.c" + return; + +} +void clif_spawn_unit(struct block_list* bl, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_spawn_unit p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1127 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1127 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 1136 "../../../server-code/src/map/clif.c" + sd = ( ((bl) == (struct block_list *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1136 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1136 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = spawn_unitType; + + p.PacketLength = sizeof(p); + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (sd) ? sd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1152 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1152 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { + p.accessory = status->get_emblem_id(bl); + p.accessory2 = GetWord(g_id, 1); + p.accessory3 = GetWord(g_id, 0); + } + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1190 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1190 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + p.body = vd->body_style; + (strlib->safestrncpy_((p.name),(clif->get_bl_name(bl)),((23 + 1)))); + + if( disguised(bl) ) { + do { if (((void)(sd), +# 1202 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1202 "../../../server-code/src/map/clif.c" + )) return; } while(0); + if( sd->status.class_ != sd->disguise ) + clif->send(&p,sizeof(p),bl,target); + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } else + clif->send(&p,sizeof(p),bl,target); + +} + + + + +void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { + struct map_session_data* sd; + struct status_change* sc = status->get_sc(bl); + struct view_data* vd = status->get_viewdata(bl); + struct packet_unit_walking p; + int g_id = status->get_guild_id(bl); + + do { if (((void)(bl), +# 1227 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1227 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1228 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1228 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 1230 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1230 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = unit_walkingType; + + p.PacketLength = sizeof(p); + + + p.objecttype = clif_bl_type(bl); + + + p.AID = bl->id; + p.GID = (tsd) ? tsd->status.char_id : 0; + + + + p.speed = status->get_speed(bl); + p.bodyState = (sc) ? sc->opt1 : 0; + p.healthState = (sc) ? sc->opt2 : 0; + p.effectState = (sc != +# 1248 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1248 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + p.job = vd->class_; + p.head = vd->hair_style; + p.weapon = vd->weapon; + p.accessory = vd->head_bottom; + p.moveStartTime = (unsigned int)timer->gettick(); + + + + p.accessory2 = vd->head_top; + p.accessory3 = vd->head_mid; + p.headpalette = vd->hair_color; + p.bodypalette = vd->cloth_color; + p.headDir = (sd)? sd->head_dir : 0; + + p.robe = vd->robe; + + p.GUID = g_id; + p.GEmblemVer = status->get_emblem_id(bl); + p.honor = (sd) ? sd->status.manner : 0; + p.virtue = (sc) ? sc->opt3 : 0; + p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; + p.sex = vd->sex; + WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + p.xSize = p.ySize = (sd) ? 5 : 0; + p.clevel = clif_setlevel(bl); + + p.font = (sd) ? sd->status.font : 0; + + + if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && (status->get_status_data(bl)->hp) < (status->get_status_data(bl)->max_hp)) { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + p.maxHP = (status->get_status_data(bl)->max_hp); + p.HP = (status->get_status_data(bl)->hp); + p.isBoss = (md->spawn != +# 1282 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1282 "../../../server-code/src/map/clif.c" + && md->spawn->state.boss) ? 1 : 0; + } else { + p.maxHP = -1; + p.HP = -1; + p.isBoss = 0; + } + + + p.body = vd->body_style; + (strlib->safestrncpy_((p.name),(clif->get_bl_name(bl)),((23 + 1)))); + + + clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); + + if( disguised(bl) ) { + + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; + p.GID = -bl->id; + + + + clif->send(&p,sizeof(p),bl,SELF); + } +} + + + + + +void clif_class_change(struct block_list *bl, int class_, int type) +{ + do { if (((void)(bl), +# 1313 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1313 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!pc->db_checkid(class_)) + { + unsigned char buf[16]; + WBUFW(buf,0)=0x1b0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + WBUFL(buf,7)=class_; + clif->send(buf,packet_db[0x1b0].len,bl,AREA); + } +} + + + + +void clif_spiritball_single(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1330 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1330 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x1e1].len); + WFIFOW(fd,0)=0x1e1; + WFIFOL(fd,2)=sd->bl.id; + WFIFOW(fd,6)=sd->spiritball; + WFIFOSET(fd, packet_db[0x1e1].len); +} + + + + +void clif_charm_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 1343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd, packet_db[0x08cf].len); + WFIFOW(fd,0) = 0x08cf; + WFIFOL(fd,2) = sd->bl.id; + WFIFOW(fd,6) = sd->charm_type; + WFIFOW(fd,8) = sd->charm_count; + WFIFOSET(fd, packet_db[0x08cf].len); +} + + + + + +void clif_weather_check(struct map_session_data *sd) { + int16 m; + int fd; + + do { if (((void)(sd), +# 1360 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1360 "../../../server-code/src/map/clif.c" +)) return; } while(0); + m = sd->bl.m; + fd = sd->fd; + if (map->list[m].flag.snow) + clif->specialeffect_single(&sd->bl, 162, fd); + if (map->list[m].flag.clouds) + clif->specialeffect_single(&sd->bl, 233, fd); + if (map->list[m].flag.clouds2) + clif->specialeffect_single(&sd->bl, 516, fd); + if (map->list[m].flag.fog) + clif->specialeffect_single(&sd->bl, 515, fd); + if (map->list[m].flag.fireworks) { + clif->specialeffect_single(&sd->bl, 297, fd); + clif->specialeffect_single(&sd->bl, 299, fd); + clif->specialeffect_single(&sd->bl, 301, fd); + } + if (map->list[m].flag.sakura) + clif->specialeffect_single(&sd->bl, 163, fd); + if (map->list[m].flag.leaves) + clif->specialeffect_single(&sd->bl, 333, fd); +} + + + +void clif_weather(int16 m) +{ + struct s_mapiterator* iter; + struct map_session_data *sd= +# 1387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1387 "../../../server-code/src/map/clif.c" + ; + + iter = (mapit->alloc(MAPIT_NORMAL,BL_PC)); + for (sd = ((TBL_PC *)BL_UCAST_(mapit->first(iter))); mapit->exists(iter); sd = ((TBL_PC *)BL_UCAST_(mapit->next(iter)))) { + if( sd->bl.m == m ) + clif->weather_check(sd); + } + mapit->free(iter); +} + + + + +# 1399 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 1399 "../../../server-code/src/map/clif.c" + clif_spawn(struct block_list *bl) +{ + struct view_data *vd; + + do { if (((void)(bl), +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +)) return( +# 1403 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1403 "../../../server-code/src/map/clif.c" +); } while(0); + vd = status->get_viewdata(bl); + if( !vd ) + return +# 1406 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1406 "../../../server-code/src/map/clif.c" + ; + + if (vd->class_ == INVISIBLE_CLASS) + return +# 1409 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1409 "../../../server-code/src/map/clif.c" + ; + + if (bl->type == BL_NPC) { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return +# 1414 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1414 "../../../server-code/src/map/clif.c" + ; + } + + clif->spawn_unit(bl,AREA_WOS); + + if (vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + int i; + if (sd->spiritball > 0) + clif->spiritball(&sd->bl); + if (sd->state.size == SZ_BIG) + clif->specialeffect(bl,423,AREA); + else if (sd->state.size == SZ_MEDIUM) + clif->specialeffect(bl,421,AREA); + if (sd->bg_id != 0 && map->list[sd->bl.m].flag.battleground) + clif->sendbgemblem_area(sd); + for (i = 0; i < sd->sc_display_count; i++) { + clif->sc_load(&sd->bl, sd->bl.id,AREA,status->dbs->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); + } + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->spiritcharm(sd); + if (sd->status.robe) + clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size==SZ_BIG) + clif->specialeffect(&md->bl,423,AREA); + else if (md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->size == SZ_BIG) + clif->specialeffect(&nd->bl,423,AREA); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect(&nd->bl,421,AREA); + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 1466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1466 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + return +# 1469 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1469 "../../../server-code/src/map/clif.c" + ; +} + + + +void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { + struct status_data *hstatus; + unsigned char buf[128]; + enum homun_type htype; + + do { if (((void)(sd), +# 1479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(hd), +# 1480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + hstatus = &hd->battle_status; + htype = homun->class2type(hd->homunculus.class_); + + memset(buf,0,packet_db[0x22e].len); + WBUFW(buf,0)=0x22e; + memcpy(WBUFP(buf,2),hd->homunculus.name,(23 + 1)); + + WBUFB(buf,26)=(battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); + WBUFW(buf,27)=hd->homunculus.level; + WBUFW(buf,29)=hd->homunculus.hunger; + WBUFW(buf,31)=(unsigned short) (hd->homunculus.intimacy / 100) ; + WBUFW(buf,33)=0; + + WBUFW(buf,35) = (((hstatus->rhw.atk2) >= ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + )) ? ( +# 1495 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1495 "../../../server-code/src/map/clif.c" + ) : ((hstatus->rhw.atk2) <= (0)) ? (0) : (hstatus->rhw.atk2)); + + + + WBUFW(buf,37)=(((hstatus->matk_max) >= ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + )) ? ( +# 1499 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1499 "../../../server-code/src/map/clif.c" + ) : ((hstatus->matk_max) <= (0)) ? (0) : (hstatus->matk_max)); + WBUFW(buf,39)=hstatus->hit; + if (battle_config.hom_setting&0x10) + WBUFW(buf,41)=hstatus->luk/3 + 1; + else + WBUFW(buf,41)=hstatus->cri/10; + + WBUFW(buf,43) = hstatus->def + hstatus->def2; + WBUFW(buf,45) = hstatus->mdef + hstatus->mdef2; + + + + + WBUFW(buf,47)=hstatus->flee; + WBUFW(buf,49)=(flag)?0:hstatus->amotion; + if (hstatus->max_hp > +# 1514 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1514 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,51) = hstatus->hp/(hstatus->max_hp/100); + WBUFW(buf,53) = 100; + } else { + WBUFW(buf,51)=hstatus->hp; + WBUFW(buf,53)=hstatus->max_hp; + } + if (hstatus->max_sp > +# 1521 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 1521 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,55) = hstatus->sp/(hstatus->max_sp/100); + WBUFW(buf,57) = 100; + } else { + WBUFW(buf,55)=hstatus->sp; + WBUFW(buf,57)=hstatus->max_sp; + } + WBUFL(buf,59)=hd->homunculus.exp; + WBUFL(buf,63)=hd->exp_next; + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) + WBUFL(buf,63)=0; + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) + WBUFL(buf,63)=0; + break; + } + WBUFW(buf,67)=hd->homunculus.skillpts; + WBUFW(buf,69)=(status->get_status_data(&hd->bl)->rhw.range); + clif->send(buf,packet_db[0x22e].len,&sd->bl,SELF); +} +# 1556 "../../../server-code/src/map/clif.c" +void clif_send_homdata(struct map_session_data *sd, int state, int param) +{ + int fd; + + do { if (((void)(sd), +# 1560 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1560 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1561 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1561 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + homun->calc_skilltree(sd->hd, 0); + + WFIFOHEAD(fd, packet_db[0x230].len); + WFIFOW(fd,0)=0x230; + WFIFOB(fd,2)=0; + WFIFOB(fd,3)=state; + WFIFOL(fd,4)=sd->hd->bl.id; + WFIFOL(fd,8)=param; + WFIFOSET(fd,packet_db[0x230].len); +} + + +void clif_homskillinfoblock(struct map_session_data *sd) { + struct homun_data *hd; + int fd; + int i,j; + int len=4; + do { if (((void)(sd), +# 1582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + hd = sd->hd; + + if ( !hd ) + return; + + WFIFOHEAD(fd, 4+37*43); + WFIFOW(fd,0)=0x235; + + for ( i = 0; i < 43; i++ ) { + int id = hd->homunculus.hskill[i].id; + if ( id != 0 ) { + j = id - 8001; + WFIFOW(fd,len) = id; + WFIFOW(fd,len + 2) = skill->get_inf(id); + WFIFOW(fd,len + 4) = 0; + WFIFOW(fd,len + 6) = hd->homunculus.hskill[j].lv; + if ( hd->homunculus.hskill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, hd->homunculus.hskill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&sd->hd->bl, id, hd->homunculus.hskill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd, len + 12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd, len + 36) = (hd->homunculus.hskill[j].lv < homun->skill_tree_get_max(id, hd->homunculus.class_)) ? 1 : 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + return; +} + +void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { + struct homun_data *hd; + int fd, idx; + do { if (((void)(sd), +# 1622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->hd), +# 1623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + idx = skill_id - 8001; + + fd=sd->fd; + hd=sd->hd; + + WFIFOHEAD(fd, packet_db[0x239].len); + WFIFOW(fd,0) = 0x239; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = hd->homunculus.hskill[idx].lv; + WFIFOW(fd,6) = skill->get_sp(skill_id,hd->homunculus.hskill[idx].lv); + WFIFOW(fd,8) = skill->get_range2(&hd->bl, skill_id,hd->homunculus.hskill[idx].lv); + WFIFOB(fd,10) = (hd->homunculus.hskill[idx].lv < skill->get_max(hd->homunculus.hskill[idx].id)) ? 1 : 0; + WFIFOSET(fd,packet_db[0x239].len); +} + +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + do { if (((void)(sd), +# 1642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1642 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x22f].len); + WFIFOW(fd,0)=0x22f; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x22f].len); + + return; +} + + + +void clif_walkok(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 1660 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1660 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x87].len); + WFIFOW(fd,0)=0x87; + WFIFOL(fd,2)=(unsigned int)timer->gettick(); + WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); + WFIFOSET(fd,packet_db[0x87].len); +} + +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { + + struct status_change *sc = +# 1671 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1671 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(bl), +# 1674 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1674 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vd), +# 1675 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1675 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(ud), +# 1676 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1676 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK) ) + clif->ally_only = +# 1680 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1680 "../../../server-code/src/map/clif.c" + ; + + + clif->set_unit_walking(bl, +# 1683 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1683 "../../../server-code/src/map/clif.c" + ,ud,AREA_WOS); + + if(vd->cloth_color) + clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); + if (vd->body_style) + clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS); + + switch(bl->type) { + case BL_PC: + { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + + if(sd->state.size==SZ_BIG) + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + 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 ) + clif->send_petdata( +# 1712 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1712 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } + + clif->ally_only = +# 1716 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1716 "../../../server-code/src/map/clif.c" + ; + +} + + + + +void clif_move(struct unit_data *ud) +{ + unsigned char buf[16]; + struct view_data *vd; + struct block_list *bl; + + struct status_change *sc = +# 1729 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1729 "../../../server-code/src/map/clif.c" + ; + + + do { if (((void)(ud), +# 1732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + bl = ud->bl; + do { if (((void)(bl), +# 1734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if (ud->state.speed_changed) { + + + ud->state.speed_changed = 0; + clif->move2(bl, vd, ud); + return; + } + + if( (sc = status->get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE) ) + clif->ally_only = +# 1755 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 1755 "../../../server-code/src/map/clif.c" + ; + + + WBUFW(buf,0)=0x86; + WBUFL(buf,2)=bl->id; + WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WBUFL(buf,12)=(unsigned int)timer->gettick(); + + clif->send(buf, packet_db[0x86].len, bl, AREA_WOS); + + if (disguised(bl)) { + WBUFL(buf,2)=-bl->id; + clif->send(buf, packet_db[0x86].len, bl, SELF); + } + + clif->ally_only = +# 1770 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 1770 "../../../server-code/src/map/clif.c" + ; + +} + + + + +int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data *sd = +# 1778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1778 "../../../server-code/src/map/clif.c" + ; + + + if ((sd = map->id2sd(id)) != +# 1781 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1781 "../../../server-code/src/map/clif.c" + && sd->fd == 0) + map->quit(sd); + return 0; +} + + + + +void clif_quitsave(int fd, struct map_session_data *sd) { + do { if (((void)(sd), +# 1790 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1790 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!battle_config.prevent_logout || + ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + map->quit(sd); + else if (sd->fd) { + + + sockt->session[sd->fd]->session_data = +# 1797 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1797 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + timer->add(timer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); + } +} + + + +void clif_changemap(struct map_session_data *sd, short m, int x, int y) { + int fd; + do { if (((void)(sd), +# 1807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x91].len); + WFIFOW(fd,0) = 0x91; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOSET(fd,packet_db[0x91].len); +} + + + +void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { + int fd; + do { if (((void)(sd), +# 1822 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1822 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x92].len); + WFIFOW(fd,0) = 0x92; + mapindex->getmapname_ext(mapindex->id2name((map_index),"../../../server-code/src/map/clif.c", 1827, __func__), WFIFOP(fd,2)); + WFIFOW(fd,18) = x; + WFIFOW(fd,20) = y; + WFIFOL(fd,22) = htonl(ip); + WFIFOW(fd,26) = sockt->ntows(htons(port)); + WFIFOSET(fd,packet_db[0x92].len); +} + +void clif_blown(struct block_list *bl) +{ + + do { if (((void)(bl), +# 1838 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1838 "../../../server-code/src/map/clif.c" +)) return; } while(0); + clif->fixpos(bl); + clif->slide(bl, bl->x, bl->y); +} + + + + + +void clif_fixpos(struct block_list *bl) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 1850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x88; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->x; + WBUFW(buf,8) = bl->y; + clif->send(buf, packet_db[0x88].len, bl, AREA); + + if( disguised(bl) ) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x88].len, bl, SELF); + } +} + + + +void clif_npcbuysell(struct map_session_data* sd, int id) +{ + int fd; + + do { if (((void)(sd), +# 1870 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1870 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xc4].len); + WFIFOW(fd,0)=0xc4; + WFIFOL(fd,2)=id; + WFIFOSET(fd,packet_db[0xc4].len); +} + + + +void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 1882 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i,c; + + do { if (((void)(sd), +# 1886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 1887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1887 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + } + + fd = sd->fd; + + WFIFOHEAD(fd, 4 + shop_size * 11); + WFIFOW(fd,0) = 0xc6; + + c = 0; + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->exists(shop[i].nameid); + int val = shop[i].value; + if( id == +# 1907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 1907 "../../../server-code/src/map/clif.c" + ) + continue; + WFIFOL(fd, 4+c*11) = val; + WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val); + WFIFOB(fd,12+c*11) = itemtype(id->type); + WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + WFIFOW(fd,2) = 4 + c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_selllist(struct map_session_data *sd) +{ + int fd,i,c=0,val; + + do { if (((void)(sd), +# 1927 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1927 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, 100 * 10 + 4); + WFIFOW(fd,0)=0xc7; + for( i = 0; i < 100; i++ ) + { + if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) + { + if( !(itemdb->isrestricted((&sd->status.inventory[i]), (( (sd)->group->level )), 0, itemdb->cansell_sub)) ) + continue; + + if( sd->status.inventory[i].expire_time ) + continue; + + if( sd->status.inventory[i].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) + continue; + + val=sd->inventory_data[i]->value_sell; + if( val < 0 ) + continue; + WFIFOW(fd,4+c*10)=i+2; + WFIFOL(fd,6+c*10)=val; + WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val); + c++; + } + } + WFIFOW(fd,2)=c*10+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1966 "../../../server-code/src/map/clif.c" +void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { + int fd = sd->fd; + size_t slen; + + do { if (((void)(sd), +# 1970 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1970 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 1971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + slen = strlen(mes) + 9; + + sd->state.dialog = 1; + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb4; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 1994 "../../../server-code/src/map/clif.c" +void clif_scriptnext(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 1998 "../../../server-code/src/map/clif.c" 3 4 +0 +# 1998 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb5].len); + WFIFOW(fd,0)=0xb5; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb5].len); +} +# 2022 "../../../server-code/src/map/clif.c" +void clif_scriptclose(struct map_session_data *sd, int npcid) +{ + int fd; + + do { if (((void)(sd), +# 2026 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2026 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xb6].len); + WFIFOW(fd,0)=0xb6; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0xb6].len); +} + + + + +void clif_sendfakenpc(struct map_session_data *sd, int npcid) { + unsigned char *buf; + int fd; + + do { if (((void)(sd), +# 2042 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2042 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + sd->state.using_fake_npc = 1; + WFIFOHEAD(fd, packet_db[0x78].len); + buf = WFIFOP(fd,0); + memset(WBUFP(buf,0), 0, packet_db[0x78].len); + WBUFW(buf,0)=0x78; + + WBUFB(buf,2) = 0; + buf = WFIFOP(fd,1); + + WBUFL(buf,2)=npcid; + WBUFW(buf,14)=111; + WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir); + WBUFB(buf,49)=5; + WBUFB(buf,50)=5; + WFIFOSET(fd, packet_db[0x78].len); +} +# 2081 "../../../server-code/src/map/clif.c" +void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { + int fd; + size_t slen; + struct block_list *bl = +# 2084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2084 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2086 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2086 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 2087 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2087 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + slen = strlen(mes) + 9; + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2090 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2090 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + WFIFOHEAD(fd, slen); + WFIFOW(fd,0)=0xb7; + WFIFOW(fd,2)=slen; + WFIFOL(fd,4)=npcid; + memcpy(WFIFOP(fd,8), mes, slen-8); + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 2114 "../../../server-code/src/map/clif.c" +void clif_scriptinput(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2116 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2116 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2120 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2120 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x142].len); + WFIFOW(fd,0)=0x142; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x142].len); +} +# 2143 "../../../server-code/src/map/clif.c" +void clif_scriptinputstr(struct map_session_data *sd, int npcid) { + int fd; + struct block_list *bl = +# 2145 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2145 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 2147 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2147 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != +# 2149 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2149 "../../../server-code/src/map/clif.c" + && (bl->m!=sd->bl.m || + bl->xbl.x-(battle->bc->area_size)-1 || bl->x>sd->bl.x+(battle->bc->area_size)+1 || + bl->ybl.y-(battle->bc->area_size)-1 || bl->y>sd->bl.y+(battle->bc->area_size)+1)))) + clif->sendfakenpc(sd, npcid); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1d4].len); + WFIFOW(fd,0)=0x1d4; + WFIFOL(fd,2)=npcid; + WFIFOSET(fd,packet_db[0x1d4].len); +} +# 2171 "../../../server-code/src/map/clif.c" +void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +{ + int fd; + + do { if (((void)(sd), +# 2175 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2175 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x144].len); + WFIFOW(fd,0)=0x144; + WFIFOL(fd,2)=npc_id; + WFIFOL(fd,6)=type; + WFIFOL(fd,10)=x; + WFIFOL(fd,14)=y; + WFIFOB(fd,18)=id; + WFIFOL(fd,19)=color; + WFIFOSET(fd,packet_db[0x144].len); +} +# 2198 "../../../server-code/src/map/clif.c" +void clif_cutin(struct map_session_data* sd, const char* image, int type) +{ + int fd; + + do { if (((void)(sd), +# 2202 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2202 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x1b3].len); + WFIFOW(fd,0)=0x1b3; + strncpy(WFIFOP(fd,2),image,64); + WFIFOB(fd,66)=type; + WFIFOSET(fd,packet_db[0x1b3].len); +} + + + + +void clif_addcards(unsigned char* buf, struct item* item) { + int i=0,j; + do { if (((void)(buf), +# 2217 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2217 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2218 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2218 "../../../server-code/src/map/clif.c" + ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + WBUFW(buf,0) = 0; + WBUFW(buf,2) = 0; + WBUFW(buf,4) = 0; + WBUFW(buf,6) = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + WBUFW(buf,0) = item->card[0]; + WBUFW(buf,2) = item->card[1]; + WBUFW(buf,4) = item->card[2]; + WBUFW(buf,6) = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,0) = j; + else + WBUFW(buf,0) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,2) = j; + else + WBUFW(buf,2) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,4) = j; + else + WBUFW(buf,4) = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + WBUFW(buf,6) = j; + else + WBUFW(buf,6) = item->card[i]; +} + +void clif_addcards2(unsigned short *cards, struct item* item) { + int i=0,j; + do { if (((void)(cards), +# 2267 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2267 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( item == +# 2268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2268 "../../../server-code/src/map/clif.c" + ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = 0; + return; + } + if( item->card[0] == ((short)0xFF00) ) { + cards[0] = 0; + cards[1] = 0; + cards[2] = 0; + cards[3] = item->card[3]; + return; + } + if( item->card[0] == 0x00FF || item->card[0] == 0x00FE ) { + cards[0] = item->card[0]; + cards[1] = item->card[1]; + cards[2] = item->card[2]; + cards[3] = item->card[3]; + return; + } + + if( 4 > 4 && (j = (itemdb->search(item->nameid)->slot)) > 4 ) + i = rnd()%(j-3); + + + if( item->card[i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[0] = j; + else + cards[0] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[1] = j; + else + cards[1] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[2] = j; + else + cards[2] = item->card[i]; + + if( item->card[++i] > 0 && (j=(itemdb->search(item->card[i])->view_id)) > 0 ) + cards[3] = j; + else + cards[3] = item->card[i]; +} +# 2324 "../../../server-code/src/map/clif.c" +void clif_add_random_options(unsigned char* buf, struct item* item) +{ + int i; + do { if (((void)(buf), +# 2327 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2327 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for (i = 0; i < 5; i++){ + WBUFW(buf,i*5+0) = 0; + WBUFW(buf,i*5+2) = 0; + WBUFB(buf,i*5+4) = 0; + } +} + + + + + + + +void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { + struct packet_additem p; + do { if (((void)(sd), +# 2343 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2343 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!sockt->session_is_active(sd->fd)) + return; + + if( fail ) + memset(&p, 0, sizeof(p)); + + p.PacketType = additemType; + p.Index = n+2; + p.count = amount; + + if( !fail ) { + + int i; + + if( n < 0 || n >= 100 || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == +# 2359 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2359 "../../../server-code/src/map/clif.c" + ) + return; + + if (sd->inventory_data[n]->view_id > 0) + p.nameid = sd->inventory_data[n]->view_id; + else + p.nameid = sd->status.inventory[n].nameid; + + p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; + p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.refiningLevel =sd->status.inventory[n].refine; + clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); + p.location = pc->equippoint(sd,n); + p.type = itemtype(sd->inventory_data[n]->type); + + p.HireExpireDate = sd->status.inventory[n].expire_time; + + + + + + p.bindOnEquipType = sd->status.inventory[n].bound && !itemdb->isstackable2(sd->inventory_data[n]) ? 2 : sd->inventory_data[n]->flag.bindonequip ? 1 : 0; + + + for (i=0; i<5; i++){ + p.option_data[i].index = 0; + p.option_data[i].value = 0; + p.option_data[i].param = 0; + } + + } + p.result = (unsigned char)fail; + + clif->send(&p,sizeof(p),&sd->bl,SELF); +} + + + +void clif_dropitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 2401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0xaf].len); + WFIFOW(fd,0)=0xaf; + WFIFOW(fd,2)=n+2; + WFIFOW(fd,4)=amount; + WFIFOSET(fd,packet_db[0xaf].len); +} + + + + +void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +{ + + + + int fd; + + do { if (((void)(sd), +# 2421 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2421 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, packet_db[0x7fa].len); + WFIFOW(fd,0)=0x7fa; + WFIFOW(fd,2)=reason; + WFIFOW(fd,4)=n+2; + WFIFOW(fd,6)=amount; + WFIFOSET(fd,packet_db[0x7fa].len); + +} + + + + + +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 + WBUFW(buf,n)=i->nameid; + WBUFB(buf,n+2)=itemtype(id->type); + WBUFB(buf,n+3)=i->identify; + if (equip >= 0) { + WBUFW(buf,n+4)=equip; + WBUFW(buf,n+6)=i->equip; + WBUFB(buf,n+8)=i->attribute; + WBUFB(buf,n+9)=i->refine; + } else { + WBUFW(buf,n+4)=i->amount; + if (equip == -2 && id->equip == EQP_AMMO) + WBUFW(buf,n+6)=EQP_AMMO; + else + WBUFW(buf,n+6)=0; + } + +} + +void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos) { + + int j; + + do { if (((void)(p), +# 2464 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2464 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->location = eqp_pos; + p->WearState = i->equip; + + + + p->RefiningLevel = i->refine; + + clif->addcards2(&p->slot.card[0], i); + + + p->HireExpireDate = i->expire_time; + + + + p->bindOnEquipType = i->bound ? 2 : id->flag.bindonequip ? 1 : 0; + + + + p->wItemSpriteNumber = (id->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) ? id->look : 0; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + + + + p->option_count = 0; + for (j=0; j<5; j++){ + p->option_data[j].index = 0; + p->option_data[j].value = 0; + p->option_data[j].param = 0; + } + +} + +void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { + do { if (((void)(p), +# 2519 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2519 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 2520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(id), +# 2521 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2521 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p->index = idx; + + if (id->view_id > 0) + p->ITID = id->view_id; + else + p->ITID = i->nameid; + + p->type = itemtype(id->type); + + + + + + p->count = i->amount; + p->WearState = id->equip; + + + clif->addcards2(&p->slot.card[0], i); + + + + p->HireExpireDate = i->expire_time; + + + + p->Flag.IsIdentified = i->identify ? 1 : 0; + p->Flag.PlaceETCTab = i->favorite ? 1 : 0; + p->Flag.SpareBits = 0; + +} + +void clif_inventorylist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + + do { if (((void)(sd), +# 2557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2560 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2560 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); + } + + if( normal ) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( sd->equip_index[EQI_AMMO] >= 0 ) + clif->arrowequip(sd,sd->equip_index[EQI_AMMO]); + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2594 "../../../server-code/src/map/clif.c" +} + + +void clif_equiplist(struct map_session_data *sd) { + int i, equip = 0; + + do { if (((void)(sd), +# 2600 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2600 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 2603 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2603 "../../../server-code/src/map/clif.c" + ) + continue; + if( !itemdb->isstackable2(sd->inventory_data[i]) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); + } + + if( equip ) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +# 2626 "../../../server-code/src/map/clif.c" +} + +void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { + int i = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(items), +# 2633 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2633 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else + clif->item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } + + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + + + (strlib->safestrncpy_((storelist_normal.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + + + (strlib->safestrncpy_((storelist_equip.name),("Storage"),((23 + 1)))); + + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } + + } while ( i < items_length ); + +} + +void clif_cartlist(struct map_session_data *sd) { + int i, normal = 0, equip = 0; + struct item_data *id; + + do { if (((void)(sd), +# 2680 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2680 "../../../server-code/src/map/clif.c" +)) return; } while(0); + for( i = 0; i < 100; i++ ) { + + if( sd->status.cart[i].nameid <= 0 ) + continue; + + id = itemdb->search(sd->status.cart[i].nameid); + if( !itemdb->isstackable2(id) ) + clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.cart[i],id,id->equip); + else + clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.cart[i],id); + } + + if( normal ) { + itemlist_normal.PacketType = cartlistnormalType; + itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + + clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + itemlist_equip.PacketType = cartlistequipType; + itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + + clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); + } +} + + + + + + +void clif_clearcart(int fd) +{ + WFIFOHEAD(fd, packet_db[0x12b].len); + WFIFOW(fd,0) = 0x12b; + WFIFOSET(fd, packet_db[0x12b].len); + +} + + + +void clif_guild_xy(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2727 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2727 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +void clif_guild_xy_single(int fd, struct map_session_data *sd) +{ + if( sd->bg_id ) + return; + + do { if (((void)(sd), +# 2744 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2744 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x1eb].len); + WFIFOW(fd,0)=0x1eb; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x1eb].len); +} + + +void clif_guild_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 2758 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2758 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1eb; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x1eb].len,&sd->bl,GUILD_SAMEMAP_WOS); +} + + + + +int clif_hpmeter_sub(struct block_list *bl, va_list ap) +{ + + + + const int cmd = 0x80e; + + struct map_session_data *sd = +# 2777 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 2777 "../../../server-code/src/map/clif.c" + ap +# 2777 "../../../server-code/src/map/clif.c" 3 4 + , +# 2777 "../../../server-code/src/map/clif.c" + struct map_session_data * +# 2777 "../../../server-code/src/map/clif.c" 3 4 + ) +# 2777 "../../../server-code/src/map/clif.c" + ; + struct map_session_data *tsd = ( ((bl) == (struct block_list *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 2778 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 2778 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + do { if (((void)(sd), +# 2780 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2780 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(tsd), +# 2781 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2781 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + if( !tsd->fd || tsd == sd ) + return 0; + + if( !( ((tsd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((tsd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) + return 0; + WFIFOHEAD(tsd->fd,packet_db[cmd].len); + WFIFOW(tsd->fd,0) = cmd; + WFIFOL(tsd->fd,2) = sd->status.account_id; +# 2801 "../../../server-code/src/map/clif.c" + WFIFOL(tsd->fd,6) = sd->battle_status.hp; + WFIFOL(tsd->fd,10) = sd->battle_status.max_hp; + + WFIFOSET(tsd->fd,packet_db[cmd].len); + return 0; +} + + + + + +int clif_hpmeter(struct map_session_data *sd) { + do { if (((void)(sd), +# 2813 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2813 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_PC, sd); + return 0; +} +# 2826 "../../../server-code/src/map/clif.c" +void clif_updatestatus(struct map_session_data *sd,int type) +{ + int fd,len; + + do { if (((void)(sd), +# 2830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 2830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + WFIFOHEAD(fd, 14); + WFIFOW(fd,0)=0xb0; + WFIFOW(fd,2)=type; + len = packet_db[0xb0].len; + switch(type){ + + case SP_WEIGHT: + pc->updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; + 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: + 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; + + if( map->list[sd->bl.m].hpmeter_visible ) + 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)=((sd)->battle_status.batk); + break; + case SP_DEF1: + WFIFOL(fd,4)=((sd)->battle_status.def2); + break; + case SP_MDEF1: + WFIFOL(fd,4)=((sd)->battle_status.mdef2); + break; + case SP_ATK2: + WFIFOL(fd,4)=((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + break; + case SP_DEF2: + WFIFOL(fd,4)=((sd)->battle_status.def); + break; + case SP_MDEF2: { + + int mdef2 = ((sd)->battle_status.mdef); + + WFIFOL(fd,4)= + + + + mdef2; + + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + break; + case SP_MATK2: + WFIFOL(fd,4)=(status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + len = packet_db[0xb1].len; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + len = packet_db[0xb1].len; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + len = packet_db[0xb1].len; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextbaseexp(sd); + len = packet_db[0xb1].len; + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc->nextjobexp(sd); + len = packet_db[0xb1].len; + break; + + + + + 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 = packet_db[0xbe].len; + break; + + + + + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len = packet_db[0x13a].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + 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 = packet_db[0x141].len; + break; + + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=100; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len = packet_db[0x121].len; + break; + + default: + (showmsg->showError(("clif->updatestatus : unrecognized type %d\n"),type)); + return; + } + WFIFOSET(fd,len); +} + + + +void clif_changestatus(struct map_session_data* sd,int type,int val) +{ + unsigned char buf[12]; + + do { if (((void)(sd), +# 3055 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3055 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1ab; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=type; + + switch(type) + { + case SP_MANNER: + WBUFL(buf,8)=val; + break; + default: + (showmsg->showError(("clif_changestatus : unrecognized type %d.\n"),type)); + return; + } + + clif->send(buf,packet_db[0x1ab].len,&sd->bl,AREA_WOS); +} + + +void clif_changelook(struct block_list *bl,int type,int val) +{ + struct map_session_data* sd; + struct status_change* sc; + struct view_data* vd; + enum send_target target = AREA; + int val2 = 0; + do { if (((void)(bl), +# 3082 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3082 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3084 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3084 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + sc = status->get_sc(bl); + vd = status->get_viewdata(bl); + + if( vd ) + 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: + if( !sd ) break; + + if ( val == INVISIBLE_CLASS ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + vd->weapon = vd->shield = 0; + + if( !vd->cloth_color ) + break; + + if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette) + vd->cloth_color = 0; + if (sd->sc.option&OPTION_OKTOBERFEST ) + vd->cloth_color = 0; + if (vd->body_style && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + vd->body_style = 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 && sd ) { + if( sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette ) + val = 0; + if( sd->sc.option&OPTION_OKTOBERFEST ) + val = 0; + } + vd->cloth_color = val; + break; + case LOOK_SHOES: + + 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; + } + + + break; + case LOOK_BODY: + case LOOK_FLOOR: + + break; + case LOOK_ROBE: + + + + vd->robe = val; + + break; + case LOOK_BODY2: + if (val && ( + sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || + sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || + sd->sc.option&OPTION_OKTOBERFEST)) + val = 0; + vd->body_style = val; + break; + } + + + if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) + target = SELF; + + + + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + do { if (((void)(vd), +# 3207 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 3207 "../../../server-code/src/map/clif.c" + )) return; } while(0); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if( disguised(bl) ) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else + clif->sendlook(bl, bl->id, type, val, val2, target); + +} + + +void clif_changetraplook(struct block_list *bl,int val) +{ + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); +} + + + +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +{ + unsigned char buf[32]; + + + + + + + + WBUFW(buf,0)=0x1d7; + WBUFL(buf,2)=id; + WBUFB(buf,6)=type; + WBUFW(buf,7)=val; + WBUFW(buf,9)=val2; + clif->send(buf,packet_db[0x1d7].len,bl,target); + +} + + +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + + + + + + +void clif_initialstatus(struct map_session_data *sd) { + int fd, mdef2; + unsigned char *buf; + + do { if (((void)(sd), +# 3262 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3262 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbd].len); + buf=WFIFOP(fd,0); + + WBUFW(buf,0)=0xbd; + WBUFW(buf,2)=(((sd->status.status_point) < ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )) ? (sd->status.status_point) : ( +# 3269 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 3269 "../../../server-code/src/map/clif.c" + )); + WBUFB(buf,4)=(((sd->status.str) < (((uint8) 0xFF))) ? (sd->status.str) : (((uint8) 0xFF))); + WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1); + WBUFB(buf,6)=(((sd->status.agi) < (((uint8) 0xFF))) ? (sd->status.agi) : (((uint8) 0xFF))); + WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1); + WBUFB(buf,8)=(((sd->status.vit) < (((uint8) 0xFF))) ? (sd->status.vit) : (((uint8) 0xFF))); + WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1); + WBUFB(buf,10)=(((sd->status.int_) < (((uint8) 0xFF))) ? (sd->status.int_) : (((uint8) 0xFF))); + WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1); + WBUFB(buf,12)=(((sd->status.dex) < (((uint8) 0xFF))) ? (sd->status.dex) : (((uint8) 0xFF))); + WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1); + WBUFB(buf,14)=(((sd->status.luk) < (((uint8) 0xFF))) ? (sd->status.luk) : (((uint8) 0xFF))); + WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1); + + WBUFW(buf,16) = ((sd)->battle_status.batk); + WBUFW(buf,18) = ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk ); + WBUFW(buf,20) = ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk); + WBUFW(buf,22) = (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level)); + WBUFW(buf,24) = ((sd)->battle_status.def2); + WBUFW(buf,26) = ((sd)->battle_status.def); + WBUFW(buf,28) = ((sd)->battle_status.mdef2); + mdef2 = ((sd)->battle_status.mdef); + WBUFW(buf,30) = + + + + mdef2; + WBUFW(buf,32) = sd->battle_status.hit; + WBUFW(buf,34) = sd->battle_status.flee; + WBUFW(buf,36) = sd->battle_status.flee2/10; + WBUFW(buf,38) = sd->battle_status.cri/10; + WBUFW(buf,40) = sd->battle_status.amotion; + WBUFW(buf,42) = 0; + + WFIFOSET(fd,packet_db[0xbd].len); + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + clif->updatestatus(sd,SP_ATTACKRANGE); + clif->updatestatus(sd,SP_ASPD); +} + + + +void clif_arrowequip(struct map_session_data *sd,int val) +{ + int fd; + + do { if (((void)(sd), +# 3322 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3322 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + clif->status_change(&sd->bl, SI_CLIENT_ONLY_EQUIP_ARROW, 1, (-1), 0, 0, 0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013c].len); + WFIFOW(fd,0)=0x013c; + WFIFOW(fd,2)=val+2; + WFIFOSET(fd,packet_db[0x013c].len); +} +# 3343 "../../../server-code/src/map/clif.c" +void clif_arrow_fail(struct map_session_data *sd,int type) +{ + int fd; + + do { if (((void)(sd), +# 3347 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3347 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd, packet_db[0x013b].len); + WFIFOW(fd,0)=0x013b; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x013b].len); +} + + + +void clif_arrow_create_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 3363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 140*2+4); + WFIFOW(fd,0) = 0x1ad; + + for (i = 0, c = 0; i < 140; i++) { + int j; + if (skill->dbs->arrow_db[i].nameid > 0 + && (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != (-1) + && !sd->status.inventory[j].equip && sd->status.inventory[j].identify + ) { + if ((j = (itemdb->search(skill->dbs->arrow_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+4) = j; + else + WFIFOW(fd,c*2+4) = skill->dbs->arrow_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = AC_MAKINGARROW; + sd->menuskill_val = c; + } +} +# 3397 "../../../server-code/src/map/clif.c" +void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +{ + int fd; + + do { if (((void)(sd), +# 3401 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3401 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xbc].len); + WFIFOW(fd,0)=0xbc; + WFIFOW(fd,2)=type; + WFIFOB(fd,4)=ok; + WFIFOB(fd,5)=(((val) >= (((uint8) 0xFF))) ? (((uint8) 0xFF)) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0xbc].len); +} + + + + +void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { + struct packet_equipitem_ack p; + + do { if (((void)(sd), +# 3418 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3418 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = equipitemackType; + p.index = n+2; + p.wearLocation = pos; + + if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&((EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)|EQP_GARMENT|(EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT))) + p.wItemSpriteNumber = sd->inventory_data[n]->look; + else + p.wItemSpriteNumber = 0; + + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { + struct packet_unequipitem_ack p; + + do { if (((void)(sd), +# 3439 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3439 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p.PacketType = unequipitemackType; + p.index = n+2; + p.wearLocation = pos; + p.result = (unsigned char)result; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} +# 3462 "../../../server-code/src/map/clif.c" +void clif_misceffect(struct block_list* bl,int type) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 3466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x19b; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf,packet_db[0x19b].len,bl,AREA); +} + + + + +void clif_changeoption(struct block_list* bl) +{ + unsigned char buf[32]; + struct status_change *sc; + struct map_session_data* sd; + + do { if (((void)(bl), +# 3484 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3484 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + sd = ( ((bl) == (struct block_list *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 3488 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3488 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + + WBUFW(buf,0) = 0x229; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = (sc) ? sc->opt1 : 0; + WBUFW(buf,8) = (sc) ? sc->opt2 : 0; + WBUFL(buf,10) = (sc != +# 3495 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3495 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFB(buf,14) = (sd)? sd->status.karma : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x229].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x229].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,10) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x229].len,bl,SELF); + } else + clif->send(buf,packet_db[0x229].len,bl,AREA); +# 3523 "../../../server-code/src/map/clif.c" +} + + + +void clif_changeoption2(struct block_list* bl) { + unsigned char buf[20]; + struct status_change *sc; + + do { if (((void)(bl), +# 3531 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3531 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if ( !(sc = status->get_sc(bl)) && bl->type != BL_NPC ) return; + + WBUFW(buf,0) = 0x28a; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = (sc != +# 3536 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3536 "../../../server-code/src/map/clif.c" + ) ? sc->option : ((bl->type == BL_NPC) ? ((const TBL_NPC *)BL_UCCAST_(bl))->option : 0); + WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,14) = (sc) ? sc->opt3 : 0; + if(disguised(bl)) { + clif->send(buf,packet_db[0x28a].len,bl,AREA_WOS); + WBUFL(buf,2) = -bl->id; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = OPTION_INVISIBLE; + clif->send(buf,packet_db[0x28a].len,bl,SELF); + } else + clif->send(buf,packet_db[0x28a].len,bl,AREA); +} + + + + +void clif_useitemack(struct map_session_data *sd,int index,int amount, +# 3553 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3553 "../../../server-code/src/map/clif.c" + ok) +{ + do { if (((void)(sd), +# 3555 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3555 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!ok) { + int fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xa8].len); + WFIFOW(fd,0)=0xa8; + WFIFOW(fd,2)=index+2; + WFIFOW(fd,4)=amount; + WFIFOB(fd,6)=ok; + WFIFOSET(fd,packet_db[0xa8].len); + } + else { +# 3576 "../../../server-code/src/map/clif.c" + unsigned char buf[32]; + + WBUFW(buf,0)=0x1c8; + WBUFW(buf,2)=index+2; + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,4)=sd->inventory_data[index]->view_id; + else + WBUFW(buf,4)=sd->status.inventory[index].nameid; + WBUFL(buf,6)=sd->bl.id; + WBUFW(buf,10)=amount; + WBUFB(buf,12)=ok; + clif->send(buf,packet_db[0x1c8].len,&sd->bl,AREA); + + } +} +# 3599 "../../../server-code/src/map/clif.c" +void clif_createchat(struct map_session_data* sd, int flag) +{ + int fd; + + do { if (((void)(sd), +# 3603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xd6].len); + WFIFOW(fd,0) = 0xd6; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xd6].len); +} +# 3619 "../../../server-code/src/map/clif.c" +void clif_dispchat(struct chat_data* cd, int fd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + || cd->owner == +# 3624 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3624 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xd7; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + if( fd ) { + WFIFOHEAD(fd,WBUFW(buf,2)); + memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2)); + WFIFOSET(fd,WBUFW(buf,2)); + } else { + clif->send(buf,WBUFW(buf,2),cd->owner,AREA_WOSC); + } +} +# 3656 "../../../server-code/src/map/clif.c" +void clif_changechatstatus(struct chat_data* cd) +{ + unsigned char buf[128]; + uint8 type; + + if( cd == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + || cd->usersd[0] == +# 3661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3661 "../../../server-code/src/map/clif.c" + ) + return; + + type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 + : (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3 + : 1; + + WBUFW(buf,0) = 0xdf; + WBUFW(buf,2) = 17 + strlen(cd->title); + WBUFL(buf, 4) = cd->owner->id; + WBUFL(buf, 8) = cd->bl.id; + WBUFW(buf,12) = cd->limit; + WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFB(buf,16) = type; + memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); + + clif->send(buf,WBUFW(buf,2),cd->owner,CHAT); +} + + + +void clif_clearchat(struct chat_data *cd,int fd) +{ + unsigned char buf[32]; + + do { if (((void)(cd), +# 3686 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3686 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xd8; + WBUFL(buf,2) = cd->bl.id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0xd8].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0xd8].len); + WFIFOSET(fd,packet_db[0xd8].len); + } else { + clif->send(buf,packet_db[0xd8].len,cd->owner,AREA_WOSC); + } +} +# 3710 "../../../server-code/src/map/clif.c" +void clif_joinchatfail(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 3714 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3714 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xda].len); + WFIFOW(fd,0) = 0xda; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0xda].len); +} + + + + + + +void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +{ + int fd; + int i,t; + + do { if (((void)(sd), +# 3734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3735 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3735 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!sockt->session_is_active(fd)) + return; + t = (int)(cd->owner->type == BL_NPC); + WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + WFIFOW(fd,0) = 0xdb; + WFIFOW(fd,2) = 8 + (28*(cd->users+t)); + WFIFOL(fd, 4) = cd->bl.id; + + if(cd->owner->type == BL_NPC) { + const struct npc_data *nd = ((const TBL_NPC *)BL_UCCAST_(cd->owner)); + WFIFOL(fd, 30) = 1; + WFIFOL(fd, 8) = 0; + memcpy(WFIFOP(fd, 12), nd->name, (23 + 1)); + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+(i+1)*28) = 1; + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + } else + for (i = 0; i < cd->users; i++) { + WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); + memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, (23 + 1)); + } + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + +void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3769 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3769 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3770 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3770 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdc; + WBUFW(buf,2) = cd->users; + memcpy(WBUFP(buf, 4),sd->status.name,(23 + 1)); + clif->send(buf,packet_db[0xdc].len,&sd->bl,CHAT_WOS); +} + + + + + + +void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +{ + unsigned char buf[64]; + + do { if (((void)(sd), +# 3787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xe1; + WBUFL(buf, 2) = 1; + memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,(23 + 1)); + + WBUFW(buf,30) = 0xe1; + WBUFL(buf,32) = 0; + memcpy(WBUFP(buf,36),sd->status.name,(23 + 1)); + + clif->send(buf,packet_db[0xe1].len*2,&sd->bl,CHAT); +} + + + + + + +void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, +# 3806 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 3806 "../../../server-code/src/map/clif.c" + flag) +{ + unsigned char buf[32]; + + do { if (((void)(sd), +# 3810 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3810 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(cd), +# 3811 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3811 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xdd; + WBUFW(buf,2) = cd->users-1; + memcpy(WBUFP(buf,4),sd->status.name,(23 + 1)); + WBUFB(buf,28) = flag; + + clif->send(buf,packet_db[0xdd].len,&sd->bl,CHAT); +} + + + + +void clif_traderequest(struct map_session_data *sd, const char *name) +{ + int fd; + + struct map_session_data* tsd = +# 3828 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3828 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3830 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3830 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 3831 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3831 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + + + + + + tsd = map->id2sd(sd->trade_partner); + if (!tsd) + return; + + WFIFOHEAD(fd,packet_db[0x1f4].len); + WFIFOW(fd,0) = 0x1f4; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f4].len); + +} +# 3863 "../../../server-code/src/map/clif.c" +void clif_tradestart(struct map_session_data *sd, uint8 type) +{ + int fd; + + struct map_session_data *tsd = +# 3867 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 3867 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 3869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + tsd = map->id2sd(sd->trade_partner); + if (tsd) { + WFIFOHEAD(fd,packet_db[0x1f5].len); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_db[0x1f5].len); + return; + } + + WFIFOHEAD(fd,packet_db[0xe7].len); + WFIFOW(fd,0) = 0xe7; + WFIFOB(fd,2) = type; + WFIFOSET(fd,packet_db[0xe7].len); +} + + + + +void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +{ + int fd; + unsigned char *buf; + do { if (((void)(sd), +# 3897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 3898 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3898 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_db[tradeaddType].len); + WBUFW(buf,0) = tradeaddType; + if( index == 0 ) + { + + + + + WBUFW(buf,2) = 0; + WBUFB(buf,4) = 0; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = 0; + WBUFB(buf,9) = 0; + WBUFB(buf,10)= 0; + WBUFW(buf,11)= 0; + WBUFW(buf,13)= 0; + WBUFW(buf,15)= 0; + WBUFW(buf,17)= 0; + + clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); + + } + else + { + index -= 2; + + + + + + + + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; + WBUFB(buf,4) = sd->inventory_data[index]->type; + WBUFL(buf,5) = amount; + buf = WBUFP(buf,1); + + WBUFB(buf,8) = sd->status.inventory[index].identify; + WBUFB(buf,9) = sd->status.inventory[index].attribute; + WBUFB(buf,10)= sd->status.inventory[index].refine; + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + + clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); + + } + WFIFOSET(fd,packet_db[tradeaddType].len); +} + + + + + + + +void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +{ + int fd; + do { if (((void)(sd), +# 3964 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3964 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xea].len); + WFIFOW(fd,0) = 0xea; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0xea].len); +} + + + + + + +void clif_tradedeal_lock(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 3982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xec].len); + WFIFOW(fd,0) = 0xec; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xec].len); +} + + + +void clif_tradecancelled(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 3996 "../../../server-code/src/map/clif.c" 3 4 +0 +# 3996 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xee].len); + WFIFOW(fd,0) = 0xee; + WFIFOSET(fd,packet_db[0xee].len); +} + + + + + + +void clif_tradecompleted(struct map_session_data* sd, int fail) +{ + int fd; + do { if (((void)(sd), +# 4012 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4012 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf0].len); + WFIFOW(fd,0) = 0xf0; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0xf0].len); +} + + + + + + +void clif_tradeundo(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xf1].len); + WFIFOW(fd,0) = 0xf1; + WFIFOSET(fd,packet_db[0xf1].len); +} + + + +void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +{ + int fd; + + do { if (((void)(sd), +# 4043 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4043 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf2].len); + WFIFOW(fd,0) = 0xf2; + WFIFOW(fd,2) = amount; + WFIFOW(fd,4) = max_amount; + WFIFOSET(fd,packet_db[0xf2].len); +} + + + + +void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +{ + int view,fd; + int offset = 0; + + do { if (((void)(sd), +# 4061 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4061 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(i), +# 4062 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4062 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + view = (itemdb->search(i->nameid)->view_id); + + WFIFOHEAD(fd,packet_db[storageaddType].len); + WFIFOW(fd,0) = storageaddType; + WFIFOW(fd,2) = index+1; + WFIFOL(fd, 4) = amount; + WFIFOW(fd,8) = ( view > 0 ) ? view : i->nameid; + + WFIFOB(fd,10) = itemtype((itemdb->search(i->nameid)->type)); + offset += 1; + + WFIFOB(fd,10+offset) = i->identify; + WFIFOB(fd,11+offset) = i->attribute; + WFIFOB(fd,12+offset) = i->refine; + clif->addcards(WFIFOP(fd,13+offset), i); + + clif->add_random_options(WFIFOP(fd,21+offset), i); + + WFIFOSET(fd,packet_db[storageaddType].len); +} + + + +void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 4091 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4091 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf6].len); + WFIFOW(fd,0)=0xf6; + WFIFOW(fd,2)=index+1; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0xf6].len); +} + + + +void clif_storageclose(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 4107 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4107 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xf8].len); + WFIFOW(fd,0) = 0xf8; + WFIFOSET(fd,packet_db[0xf8].len); +} + + + + +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { + struct block_list *d_bl; + int i; + + do { if (((void)(sd), +# 4122 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4122 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 4123 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4123 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( dstsd->chatID ) { + struct chat_data *cd = map->id2cd(dstsd->chatID); + if (cd != +# 4126 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4126 "../../../server-code/src/map/clif.c" + && cd->usersd[0] == dstsd) + 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); + if (dstsd->charm_type != CHARM_TYPE_NONE && dstsd->charm_count > 0) + clif->charm_single(sd->fd, dstsd); + + for( i = 0; i < dstsd->sc_display_count; i++ ) { + clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->dbs->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); + } + if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || + (sd->bg_id && sd->bg_id == dstsd->bg_id) || + ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) + ) + clif->hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); + + + do { for ((i) = (0); (i) < (5); ++(i)) if (sd->devotion[i] == dstsd->bl.id) break; } while( +# 4148 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4148 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&sd->bl, sd); + + do { for ((i) = (0); (i) < (5); ++(i)) if (dstsd->devotion[i] > 0) break; } while( +# 4151 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4151 "../../../server-code/src/map/clif.c" +); + if( i < 5 ) clif->devotion(&dstsd->bl, sd); + + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != +# 4154 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4154 "../../../server-code/src/map/clif.c" + ) + clif->devotion(d_bl, sd); +} + +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { + struct unit_data *ud; + struct view_data *vd; + + do { if (((void)(sd), +# 4162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4162 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 4163 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4163 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + vd = status->get_viewdata(bl); + if (!vd || vd->class_ == INVISIBLE_CLASS) + return; + + if (bl->type == BL_NPC) { + + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id == 0 && (nd->option&OPTION_INVISIBLE)) + return; + } + + if ( ( ud = unit->bl2ud(bl) ) && ud->walktimer != (-1) ) + clif->set_unit_walking(bl,sd,ud,SELF); + else + clif->set_unit_idle(bl,sd,SELF); + + if (vd->cloth_color) + clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); + if (vd->body_style) + clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF); + + switch (bl->type) { + case BL_PC: + { + struct map_session_data *tsd = ((TBL_PC *)BL_UCAST_(bl)); + clif->getareachar_pc(sd, tsd); + if (tsd->state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (tsd->state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + if (tsd->bg_id != 0 && map->list[tsd->bl.m].flag.battleground) + clif->sendbgemblem_single(sd->fd,tsd); + if (tsd->status.robe) + clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); + } + break; + case BL_MER: + { + struct mercenary_data *md = ((TBL_MER *)BL_UCAST_(bl)); + if (md->devotion_flag) + clif->devotion(bl, sd); + } + break; + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(bl)); + if (nd->chat_id != 0) + clif->dispchat(map->id2cd(nd->chat_id), sd->fd); + if (nd->size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (nd->size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); + } + break; + case BL_MOB: + { + struct mob_data *md = ((TBL_MOB *)BL_UCAST_(bl)); + if (md->special_state.size == SZ_BIG) + clif->specialeffect_single(bl,423,sd->fd); + else if (md->special_state.size == SZ_MEDIUM) + clif->specialeffect_single(bl,421,sd->fd); +# 4237 "../../../server-code/src/map/clif.c" + } + break; + case BL_PET: + if (vd->head_bottom) + clif->send_petdata( +# 4241 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4241 "../../../server-code/src/map/clif.c" + , ((TBL_PET *)BL_UCAST_(bl)), 3, vd->head_bottom); + break; + } +} + + + +static inline int clif_calc_delay(int type, int div, int damage, int delay) +{ + return ( delay == 0 && damage > 0 ) ? ( div > 1 ? 9 : 4 ) : type; +} + + + + +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; + + do { if (((void)(bl), +# 4260 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4260 "../../../server-code/src/map/clif.c" +)) return(delay); } while(0); + if (bl->type == BL_PC) { + if (battle_config.pc_walk_delay_rate != 100) + delay = delay*battle_config.pc_walk_delay_rate/100; + } else + if (battle_config.walk_delay_rate != 100) + delay = delay*battle_config.walk_delay_rate/100; + + if (div_ > 1) + delay += battle_config.multihit_delay*(div_-1); + + return delay>0?delay:1; +} + + + + + + + +int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { + struct packet_damage p; + struct status_change *sc; + + + + int damage,damage2; + + + do { if (((void)(src), +# 4289 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4289 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 4290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4290 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + if(in_damage2) in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + damage2 = (int)(((in_damage2) < (0x7fffffff)) ? (in_damage2) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage+damage2,ddelay); + + p.PacketType = damageType; + p.GID = src->id; + p.targetGID = dst->id; + p.startTime = (uint32)timer->gettick(); + p.attackMT = sdelay; + p.attackedMT = ddelay; + p.count = div; + p.action = type; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) { + p.damage = damage?div:0; + p.leftDamage = damage2?div:0; + } else { + p.damage = damage; + p.leftDamage = damage2; + } + + p.is_sp_damaged = 0; + + + if(disguised(dst)) { + clif->send(&p,sizeof(p),dst,AREA_WOS); + p.targetGID = -dst->id; + clif->send(&p,sizeof(p),dst,SELF); + } else + clif->send(&p,sizeof(p),dst,AREA); + + if(disguised(src)) { + p.GID = -src->id; + if (disguised(dst)) + p.targetGID = dst->id; + + if(damage > 0) p.damage = -1; + if(damage2 > 0) p.leftDamage = -1; + + clif->send(&p,sizeof(p),src,SELF); + } + + if(src == dst) { + unit->setdir(src,unit->getdir(src)); + } + + + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); +} + + + + +void clif_takeitem(struct block_list* src, struct block_list* dst) +{ + + unsigned char buf[32]; + + do { if (((void)(src), +# 4363 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4363 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 4364 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4364 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = src->id; + WBUFL(buf, 6) = dst->id; + WBUFB(buf,26) = 1; + clif->send(buf, packet_db[0x8a].len, src, AREA); + +} + + + + +void clif_sitting(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4380 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4380 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 2; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + + +void clif_standing(struct block_list* bl) +{ + unsigned char buf[32]; + do { if (((void)(bl), +# 4399 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4399 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x8a; + WBUFL(buf, 2) = bl->id; + WBUFB(buf,26) = 3; + clif->send(buf, packet_db[0x8a].len, bl, AREA); + + if(disguised(bl)) { + WBUFL(buf, 2) = - bl->id; + clif->send(buf, packet_db[0x8a].len, bl, SELF); + } +} + + + +void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name, WBUFP(buf,8)); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x192].len); + memcpy(WFIFOP(fd,0), buf, packet_db[0x192].len); + WFIFOSET(fd,packet_db[0x192].len); + } else { + struct block_list dummy_bl; + dummy_bl.type = BL_NUL; + dummy_bl.x = x; + dummy_bl.y = y; + dummy_bl.m = m; + clif->send(buf,packet_db[0x192].len,&dummy_bl,target); + } +} + + + +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { + int view,fd; + + do { if (((void)(sd), +# 4442 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4442 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(fitem), +# 4443 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4443 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x9d].len); + WFIFOW(fd,0)=0x9d; + WFIFOL(fd,2)=fitem->bl.id; + if((view = (itemdb->search(fitem->item_data.nameid)->view_id)) > 0) + WFIFOW(fd,6)=view; + else + WFIFOW(fd,6)=fitem->item_data.nameid; + WFIFOB(fd,8)=fitem->item_data.identify; + WFIFOW(fd,9)=fitem->bl.x; + WFIFOW(fd,11)=fitem->bl.y; + WFIFOW(fd,13)=fitem->item_data.amount; + WFIFOB(fd,15)=fitem->subx; + WFIFOB(fd,16)=fitem->suby; + WFIFOSET(fd,packet_db[0x9d].len); +} + +void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_graffiti_entry p; + + do { if (((void)(bl), +# 4465 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4465 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4466 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4466 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4467 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4467 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = graffiti_entryType; + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + p.job = su->group->unit_id; + p.isContens = 1; + p.isVisible = 1; + (strlib->safestrncpy_((p.msg),(su->group->valstr),(80))); + + clif->send(&p,sizeof(p),bl,target); +} + + + + + + +void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { + struct packet_skill_entry p; + do { if (((void)(bl), +# 4488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su), +# 4489 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4489 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(su->group), +# 4490 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4490 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( su->group->state.guildaura ) + return; + + + if(su->group->unit_id == UNT_GRAFFITI) { + clif->graffiti_entry(bl,su,target); + return; + } + + + p.PacketType = skill_entryType; + + p.PacketLength = sizeof(p); + + + p.AID = su->bl.id; + p.creatorAID = su->group->src_id; + p.xPos = su->bl.x; + p.yPos = su->bl.y; + + + if ((battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) || + (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT))) + p.job = UNT_DUMMYSKILL; + else + p.job = su->group->unit_id; + + + p.RadiusRange = (unsigned char)su->range; + + + p.isVisible = 1; + + + p.level = (unsigned char)su->group->skill_lv; + + + clif->send(&p,sizeof(p),bl,target); + + if (su->group->skill_id == WZ_ICEWALL) { + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4532 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + clif->changemapcell(sd != +# 4533 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4533 "../../../server-code/src/map/clif.c" + ? sd->fd : 0, su->bl.m, su->bl.x, su->bl.y, 5, SELF); + } +} + + + + +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + do { if (((void)(su), +# 4541 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4541 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,packet_db[0x120].len); + WFIFOW(fd,0)=0x120; + WFIFOL(fd, 2)=su->bl.id; + WFIFOSET(fd,packet_db[0x120].len); + + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); +} + + + +void clif_skill_delunit(struct skill_unit *su) { + unsigned char buf[16]; + + do { if (((void)(su), +# 4557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x120; + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_db[0x120].len,&su->bl,AREA); +} + + + + +void clif_skillunit_update(struct block_list* bl) +{ + unsigned char buf[6]; + do { if (((void)(bl), +# 4570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ac; + WBUFL(buf,2) = bl->id; + + clif->send(buf,packet_db[0x1ac].len,bl,AREA); +} + + + + +int clif_getareachar(struct block_list* bl,va_list ap) { + struct map_session_data *sd; + + do { if (((void)(bl), +# 4584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4584 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd= +# 4586 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4586 "../../../server-code/src/map/clif.c" + ap +# 4586 "../../../server-code/src/map/clif.c" 3 4 + , +# 4586 "../../../server-code/src/map/clif.c" + struct map_session_data* +# 4586 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4586 "../../../server-code/src/map/clif.c" + ; + + if (sd == +# 4588 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4588 "../../../server-code/src/map/clif.c" + || !sd->fd) + return 0; + + switch(bl->type){ + case BL_ITEM: + clif->getareachar_item(sd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&sd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); + break; + } + return 0; +} + + + + +int clif_outsight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct view_data *vd; + struct map_session_data *sd, *tsd; + tbl= +# 4615 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4615 "../../../server-code/src/map/clif.c" + ap +# 4615 "../../../server-code/src/map/clif.c" 3 4 + , +# 4615 "../../../server-code/src/map/clif.c" + struct block_list* +# 4615 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4615 "../../../server-code/src/map/clif.c" + ; + if(bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4618 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4618 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4619 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4619 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4622 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + 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 = map->id2cd(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(((TBL_ITEM *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(bl)), tsd->fd); + break; + case BL_NPC: + if (!(((TBL_NPC *)BL_UCAST_(bl))->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) { + do { if (((void)(tbl), +# 4654 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4654 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + if (tbl->type == BL_SKILL) + clif->clearchar_skillunit(((TBL_SKILL *)BL_UCAST_(tbl)), sd->fd); + else if ((vd = status->get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS + && !(tbl->type == BL_NPC && (((TBL_NPC *)BL_UCAST_(tbl))->option&OPTION_INVISIBLE))) + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + } + return 0; +} + + + + +int clif_insight(struct block_list *bl,va_list ap) +{ + struct block_list *tbl; + struct map_session_data *sd, *tsd; + tbl= +# 4671 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 4671 "../../../server-code/src/map/clif.c" + ap +# 4671 "../../../server-code/src/map/clif.c" 3 4 + , +# 4671 "../../../server-code/src/map/clif.c" + struct block_list* +# 4671 "../../../server-code/src/map/clif.c" 3 4 + ) +# 4671 "../../../server-code/src/map/clif.c" + ; + + if (bl == tbl) return 0; + + sd = ( ((bl) == (struct block_list *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 4675 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4675 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + tsd = ( ((tbl) == (struct block_list *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + || (tbl)->type != (BL_PC)) ? (TBL_PC *) +# 4676 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 4676 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(tbl) ); + + if (tsd && tsd->fd) { + do { if (((void)(bl), +# 4679 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 4679 "../../../server-code/src/map/clif.c" + )) return(0); } while(0); + switch(bl->type) { + case BL_ITEM: + clif->getareachar_item(tsd, ((TBL_ITEM *)BL_UCAST_(bl))); + break; + case BL_SKILL: + clif->getareachar_skillunit(&tsd->bl, ((TBL_SKILL *)BL_UCAST_(bl)), SELF); + break; + default: + clif->getareachar_unit(tsd,bl); + break; + } + } + if (sd && sd->fd) { + clif->getareachar_unit(sd,tbl); + } + return 0; +} + + + +void clif_skillinfoblock(struct map_session_data *sd) +{ + int fd; + int i,len,id; + + do { if (((void)(sd), +# 4705 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4705 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if (!fd) return; + + WFIFOHEAD(fd, 1478 * 37 + 4); + WFIFOW(fd,0) = 0x10f; + for ( i = 0, len = 4; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + int level; + + if (len + 37 > 8192) + break; + + WFIFOW(fd,len) = id; + WFIFOL(fd, len + 2) = skill->get_inf(id); + level = sd->status.skill[i].lv; + WFIFOW(fd,len + 6) = level; + if (level) { + WFIFOW(fd,len + 8) = skill->get_sp(id, level); + WFIFOW(fd,len + 10)= skill->get_range2(&sd->bl, id, level); + } + else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10)= 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,len+36) = 0; + len += 37; + } + } + WFIFOW(fd,2)=len; + WFIFOSET(fd,len); + + + for ( ; i < 1478; i++) { + if( (id = sd->status.skill[i].id) != 0 ) { + clif->addskill(sd, id); + clif->skillinfo(sd, id, 0); + } + } +} + + + + + + +void clif_addskill(struct map_session_data *sd, int id) +{ + int fd, skill_lv, idx = skill->get_index(id); + + do { if (((void)(sd), +# 4760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (!fd) return; + + if (sd->status.skill[idx].id <= 0) + return; + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd, packet_db[0x111].len); + WFIFOW(fd,0) = 0x111; + WFIFOW(fd,2) = id; + WFIFOL(fd,4) = skill->get_inf(id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(id)),((23 + 1)))); + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0; + else + WFIFOB(fd,38) = 0; + WFIFOSET(fd,packet_db[0x111].len); +} + + + +void clif_deleteskill(struct map_session_data *sd, int id) +{ + + int fd; + + do { if (((void)(sd), +# 4797 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4797 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( !fd ) return; + + WFIFOHEAD(fd,packet_db[0x441].len); + WFIFOW(fd,0) = 0x441; + WFIFOW(fd,2) = id; + WFIFOSET(fd,packet_db[0x441].len); + + clif->skillinfoblock(sd); +} + + + + + + + +void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +{ + int fd; + do { if (((void)(sd), +# 4818 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4818 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x10e].len); + WFIFOW(fd,0) = 0x10e; + WFIFOW(fd,2) = skill_id; + WFIFOW(fd,4) = skill_lv; + WFIFOW(fd,6) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv); + if( flag ) + WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + else + WFIFOB(fd,10) = 1; + + WFIFOSET(fd, packet_db[0x10e].len); +} + + + +void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +{ + const int fd = sd->fd; + int idx = skill->get_index(skill_id); + int skill_lv; + + do { if (((void)(sd), +# 4844 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4844 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (idx >= 0 && idx < 1478) ? +# 4845 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4845 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 4845, __func__, "idx >= 0 && idx < 1478", "failed assertion"), +# 4845 "../../../server-code/src/map/clif.c" 3 4 +1 +# 4845 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + skill_lv = sd->status.skill[idx].lv; + + WFIFOHEAD(fd,packet_db[0x7e1].len); + WFIFOW(fd,0) = 0x7e1; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = inf?inf:skill->get_inf(skill_id); + WFIFOW(fd,8) = skill_lv; + if (skill_lv > 0) { + WFIFOW(fd,10) = skill->get_sp(skill_id, skill_lv); + WFIFOW(fd,12) = skill->get_range2(&sd->bl, skill_id, skill_lv); + } else { + WFIFOW(fd,10) = 0; + WFIFOW(fd,12) = 0; + } + if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) + WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0; + else + WFIFOB(fd,14) = 0; + WFIFOSET(fd,packet_db[0x7e1].len); +} +# 4883 "../../../server-code/src/map/clif.c" +void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime) +{ + + + + const int cmd = 0x7fb; + + unsigned char buf[32]; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = src_id; + WBUFL(buf,6) = dst_id; + WBUFW(buf,10) = dst_x; + WBUFW(buf,12) = dst_y; + WBUFW(buf,14) = skill_id; + WBUFL(buf,16) = property<0?0:property; + WBUFL(buf,20) = casttime; + + WBUFB(buf,24) = 0; + + + if (disguised(bl)) { + clif->send(buf,packet_db[cmd].len, bl, AREA_WOS); + WBUFL(buf,2) = -src_id; + clif->send(buf,packet_db[cmd].len, bl, SELF); + } else + clif->send(buf,packet_db[cmd].len, bl, AREA); +} + + + +void clif_skillcastcancel(struct block_list* bl) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 4918 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4918 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1b9; + WBUFL(buf,2) = bl->id; + clif->send(buf,packet_db[0x1b9].len, bl, AREA); +} +# 4948 "../../../server-code/src/map/clif.c" +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +{ + int fd; + + if (!sd) { + + (showmsg->showDebug(("clif_skill_fail: Error, received NULL sd for skill %d\n"), skill_id)); + return; + } + + fd=sd->fd; + if (!fd) return; + + if(battle_config.display_skill_fail&1) + return; + + if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) + return; + + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) + return; + + if(skill_id == TF_POISON && battle_config.display_skill_fail&8) + return; + + WFIFOHEAD(fd,packet_db[0x110].len); + WFIFOW(fd,0) = 0x110; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = btype; + WFIFOB(fd,8) = 0; + WFIFOB(fd,9) = cause; + WFIFOSET(fd,packet_db[0x110].len); +} + + + +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +{ + + int fd; + + do { if (((void)(sd), +# 4989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 4989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x43d].len); + WFIFOW(fd,0) = 0x43d; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = duration; + WFIFOSET(fd,packet_db[0x43d].len); + +} + + + + +int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { + unsigned char buf[64]; + struct status_change *sc; + int damage; + + do { if (((void)(src), +# 5008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5008 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 5009 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5009 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + damage = (int)(((in_damage) >= (0x7fffffff)) ? (0x7fffffff) : ((in_damage) <= ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + )) ? ( +# 5011 "../../../server-code/src/map/clif.c" 3 4 + (-0x7fffffff - 1) +# 5011 "../../../server-code/src/map/clif.c" + ) : (in_damage)); + type = clif_calc_delay(type, div, damage, ddelay); + + + if (type == BDT_SKILL) type = BDT_MULTIHIT; + + + if ((sc = status->get_sc(dst)) && sc->count) { + if (sc->data[SC_ILLUSION] && damage) + damage = damage * (sc->data[SC_ILLUSION]->val2) + rnd() % 100; + } +# 5055 "../../../server-code/src/map/clif.c" + WBUFW(buf,0) = 0x1de; + WBUFW(buf,2) = skill_id; + WBUFL(buf, 4) = src->id; + WBUFL(buf, 8) = dst->id; + WBUFL(buf, 12) = (uint32)tick; + WBUFL(buf, 16) = sdelay; + WBUFL(buf, 20) = ddelay; + if (battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle)) { + WBUFL(buf, 24) = damage ? div : 0; + } else { + WBUFL(buf, 24) = damage; + } + WBUFW(buf,28) = skill_lv; + WBUFW(buf,30) = div; + + + + + + + + WBUFB(buf, 32) = (type == BDT_SKILL) ? BDT_MULTIHIT : type; + + if (disguised(dst)) { + clif->send(buf, packet_db[0x1de].len, dst, AREA_WOS); + WBUFL(buf,8)=-dst->id; + clif->send(buf, packet_db[0x1de].len, dst, SELF); + } else + clif->send(buf, packet_db[0x1de].len, dst, AREA); + + if (disguised(src)) { + WBUFL(buf, 4) = -src->id; + if (disguised(dst)) + WBUFL(buf, 8) = dst->id; + if (damage > 0) + WBUFL(buf, 24) = -1; + clif->send(buf, packet_db[0x1de].len, src, SELF); + } + + + + return clif->calc_walkdelay(dst, ddelay, type, damage, div); +} +# 5158 "../../../server-code/src/map/clif.c" +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail) +{ + unsigned char buf[32]; + + do { if (((void)(dst), +# 5162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + WBUFW(buf,0)=0x11a; + WBUFW(buf,2)=skill_id; + WBUFW(buf,4)=(((heal) < ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )) ? (heal) : ( +# 5166 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5166 "../../../server-code/src/map/clif.c" + )); + WBUFL(buf,6)=dst->id; + WBUFL(buf,10)=src?src->id:0; + WBUFB(buf,14)=fail; + + if (disguised(dst)) { + clif->send(buf,packet_db[0x11a].len,dst,AREA_WOS); + WBUFL(buf,6)=-dst->id; + clif->send(buf,packet_db[0x11a].len,dst,SELF); + } else + clif->send(buf,packet_db[0x11a].len,dst,AREA); + + if(src && disguised(src)) { + WBUFL(buf,10)=-src->id; + if (disguised(dst)) + WBUFL(buf,6)=dst->id; + clif->send(buf,packet_db[0x11a].len,src,SELF); + } + + return fail; +} + + + +void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { + unsigned char buf[32]; + + do { if (((void)(src), +# 5193 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5193 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x117; + WBUFW(buf,2)=skill_id; + WBUFL(buf,4)=src->id; + WBUFW(buf,8)=val; + WBUFW(buf,10)=x; + WBUFW(buf,12)=y; + WBUFL(buf,14)=(uint32)tick; + if(disguised(src)) { + clif->send(buf,packet_db[0x117].len,src,AREA_WOS); + WBUFL(buf,4)=-src->id; + clif->send(buf,packet_db[0x117].len,src,SELF); + } else + clif->send(buf,packet_db[0x117].len,src,AREA); +} + + + +void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +{ + int fd; + + do { if (((void)(sd), +# 5216 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5216 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x11c].len); + WFIFOW(fd,0) = 0x11c; + WFIFOW(fd,2) = skill_id; + memset(WFIFOP(fd,4), 0x00, 4*((11 + 1) + 4)); + if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); + else + if (map1 > 0) mapindex->getmapname_ext(mapindex->id2name((map1),"../../../server-code/src/map/clif.c", 5225, __func__), WFIFOP(fd,4)); + if (map2 > 0) mapindex->getmapname_ext(mapindex->id2name((map2),"../../../server-code/src/map/clif.c", 5226, __func__), WFIFOP(fd,20)); + if (map3 > 0) mapindex->getmapname_ext(mapindex->id2name((map3),"../../../server-code/src/map/clif.c", 5227, __func__), WFIFOP(fd,36)); + if (map4 > 0) mapindex->getmapname_ext(mapindex->id2name((map4),"../../../server-code/src/map/clif.c", 5228, __func__), WFIFOP(fd,52)); + WFIFOSET(fd,packet_db[0x11c].len); + + sd->menuskill_id = skill_id; + if (skill_id == AL_WARP){ + sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; + sd->state.workinprogress = 3; + }else + sd->menuskill_val = skill_lv; +} +# 5248 "../../../server-code/src/map/clif.c" +void clif_skill_memomessage(struct map_session_data* sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5252 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5252 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x11e].len); + WFIFOW(fd,0)=0x11e; + WFIFOB(fd,2)=type; + WFIFOSET(fd,packet_db[0x11e].len); +} +# 5270 "../../../server-code/src/map/clif.c" +void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 5274 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5274 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x189].len); + WFIFOW(fd,0)=0x189; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x189].len); +} + + + + +void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { + struct status_data *dstatus; + unsigned char buf[64]; + int i; + + do { if (((void)(sd), +# 5291 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5291 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dst), +# 5292 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5292 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( dst->type != BL_MOB ) + return; + + dstatus = status->get_status_data(dst); + + WBUFW(buf,0) = 0x18c; + WBUFW(buf,2) = status->get_class(dst); + WBUFW(buf,4) = status->get_lv(dst); + WBUFW(buf,6) = dstatus->size; + WBUFL(buf, 8) = dstatus->hp; + WBUFW(buf,12) = ((battle_config.estimation_type&1) ? dstatus->def : 0) + + ((battle_config.estimation_type&2) ? dstatus->def2 : 0); + WBUFW(buf,14) = dstatus->race; + WBUFW(buf,16) = ((battle_config.estimation_type&1) ? dstatus->mdef : 0) + + ((battle_config.estimation_type&2) ? dstatus->mdef2 : 0); + WBUFW(buf,18) = dstatus->def_ele; + for(i=0;i<9;i++) { + WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); + + + } + + clif->send(buf,packet_db[0x18c].len,&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); +} + + + + + +void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +{ + int i,c,view,fd; + do { if (((void)(sd), +# 5326 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5326 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(sd->menuskill_id == skill_id) + return; + if( skill_id == GC_CREATENEWPOISON ) + skill_id = GC_RESEARCHNEWPOISON; + + fd=sd->fd; + WFIFOHEAD(fd, 270 * 8 + 8); + WFIFOW(fd,0)=0x18d; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid, trigger, 1) && + ( ( skill_id > 0 && skill->dbs->produce_db[i].req_skill == skill_id ) || skill_id < 0 ) + ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*8+ 4)= view; + else + WFIFOW(fd,c*8+ 4)= skill->dbs->produce_db[i].nameid; + WFIFOW(fd,c*8+ 6)= 0; + WFIFOW(fd,c*8+ 8)= 0; + WFIFOW(fd,c*8+10)= 0; + c++; + } + } + WFIFOW(fd,2)=c*8+8; + WFIFOSET(fd,WFIFOW(fd,2)); + if(c > 0) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + return; + } +} +# 5369 "../../../server-code/src/map/clif.c" +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +{ + int fd; + int i, c; + int view; + + do { if (((void)(sd), +# 5375 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5375 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, 6 + 2 * 270); + WFIFOW(fd,0) = 0x25a; + WFIFOW(fd,4) = list_type; + + c = 0; + for( i = 0; i < 270; i++ ) { + if( !skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,trigger, qty) ) + continue; + + if( (view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0 ) + WFIFOW(fd,6 + 2 * c) = view; + else + WFIFOW(fd,6 + 2 * c) = skill->dbs->produce_db[i].nameid; + + c++; + } + + if( skill_id == AM_PHARMACY ) { + + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + + if( c > 0 ) { + sd->menuskill_id = skill_id; + sd->menuskill_val = trigger; + if( skill_id != AM_PHARMACY ) { + sd->menuskill_val2 = qty; + WFIFOW(fd,2) = 6 + 2 * c; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } else { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + if( skill_id != AM_PHARMACY ) { + + + clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); + + + + + } + } +} + +void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_sc_notick p; + struct map_session_data *sd; + + do { if (((void)(bl), +# 5427 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5427 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (type == SI_BLANK) + return; + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + sd = ( ((bl) == (struct block_list *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5435 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5435 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = sc_notickType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + clif->send(&p,packet_db[p.PacketType].len, bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + + + + + +void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { + struct packet_status_change p; + struct map_session_data *sd; + + if (type == SI_BLANK) + return; + + do { if (((void)(bl), +# 5458 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5458 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (!(status->type2relevant_bl_types(type)&bl->type)) + return; + + if ( tick < 0 ) + tick = 9999; + + sd = ( ((bl) == (struct block_list *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 5466 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5466 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = status_changeType; + p.index = type; + p.AID = bl->id; + p.state = (unsigned char)flag; + + + p.Total = tick; + + + p.Left = tick; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, (sd && sd->status.option&OPTION_INVISIBLE) ? SELF : AREA); +} + + + +void clif_displaymessage(const int fd, const char* mes) { + do { if (((void)(mes), +# 5488 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5488 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),mes)); + } else if ( fd > 0 ) { + + + + + + size_t len; + + if ( ( len = (strlib->strnlen_((mes),(255))) ) > 0 ) { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(mes),(len + 1))); + WFIFOSET(fd, 5 + len); + } + + } +} + +void clif_displaymessage2(const int fd, const char* mes) { + do { if (((void)(mes), +# 5512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + if (fd == 0 && !map->cpsd_active) + ; + else { + + char *message, *line; + + message = (iMalloc->astrdup((mes),"../../../server-code/src/map/clif.c", 5521, __func__)); + line = strtok(message, "\n"); + while(line != +# 5523 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5523 "../../../server-code/src/map/clif.c" + ) { + + size_t len = (strlib->strnlen_((line),(255))); + + if (len > 0) { + if( map->cpsd_active && fd == 0 ) { + (showmsg->showInfo(("HCP: %s\n"),line)); + } else { + WFIFOHEAD(fd, 5 + len); + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + (strlib->safestrncpy_((WFIFOP(fd,4)),(line),(len + 1))); + WFIFOSET(fd, 5 + len); + } + } + line = strtok( +# 5538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5538 "../../../server-code/src/map/clif.c" + , "\n"); + } + (iMalloc->free((message),"../../../server-code/src/map/clif.c", 5540, __func__)); + } +} + +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { + va_list ap; + + do { if (((void)(mes), +# 5548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (map->cpsd_active && fd == 0) { + (showmsg->showInfo(("HCP: "))); + +# 5551 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5551 "../../../server-code/src/map/clif.c" + ap +# 5551 "../../../server-code/src/map/clif.c" 3 4 + , +# 5551 "../../../server-code/src/map/clif.c" + mes +# 5551 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5551 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessageV((mes), (ap))); + +# 5553 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5553 "../../../server-code/src/map/clif.c" + ap +# 5553 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5553 "../../../server-code/src/map/clif.c" + ; + (showmsg->showMessage(("\n"))); + } else if (fd > 0) { + int len = 1; + char *ptr; + + WFIFOHEAD(fd, 5 + 255); + + + +# 5562 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_start( +# 5562 "../../../server-code/src/map/clif.c" + ap +# 5562 "../../../server-code/src/map/clif.c" 3 4 + , +# 5562 "../../../server-code/src/map/clif.c" + mes +# 5562 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5562 "../../../server-code/src/map/clif.c" + ; + len += vsnprintf(WFIFOP(fd,4), 255, mes, ap); + +# 5564 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_end( +# 5564 "../../../server-code/src/map/clif.c" + ap +# 5564 "../../../server-code/src/map/clif.c" 3 4 + ) +# 5564 "../../../server-code/src/map/clif.c" + ; + + + ptr = WFIFOP(fd,4); + ptr[len - 1] = '\0'; + + + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = 5 + len; + + WFIFOSET(fd, 5 + len); + } +} + + +void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) +{ + int lp = (type&BC_COLOR_MASK) ? 4 : 0; + unsigned char *buf = +# 5582 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5582 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(mes), +# 5583 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5583 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (iMalloc->malloc(((4 + lp + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5585, __func__)); + + WBUFW(buf,0) = 0x9a; + WBUFW(buf,2) = 4 + lp + len; + if( type&BC_BLUE ) + WBUFL(buf,4) = 0x65756c62; + else if( type&BC_WOE ) + WBUFL(buf,4) = 0x73737373; + memcpy(WBUFP(buf, 4 + lp), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5596, __func__)); +} + + + + + +void clif_GlobalMessage(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 5606 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5606 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_GlobalMessage: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8d; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); + +} + + + +void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +{ + unsigned char *buf; + + do { if (((void)(mes), +# 5632 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5632 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + buf = (unsigned char*)(iMalloc->malloc(((16 + len)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 5634, __func__)); + WBUFW(buf,0) = 0x1c3; + WBUFW(buf,2) = len + 16; + WBUFL(buf,4) = fontColor; + WBUFW(buf,8) = fontType; + WBUFW(buf,10) = fontSize; + WBUFW(buf,12) = fontAlign; + WBUFW(buf,14) = fontY; + memcpy(WBUFP(buf,16), mes, len); + clif->send(buf, WBUFW(buf,2), bl, target); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 5645, __func__)); +} + + + + + + + +void clif_heal(int fd,int type,int val) +{ + WFIFOHEAD(fd,packet_db[0x13d].len); + WFIFOW(fd,0)=0x13d; + WFIFOW(fd,2)=type; + WFIFOW(fd,4)=(((val) >= ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + )) ? ( +# 5659 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 5659 "../../../server-code/src/map/clif.c" + ) : ((val) <= (0)) ? (0) : (val)); + WFIFOSET(fd,packet_db[0x13d].len); +} + + + + + +void clif_resurrection(struct block_list *bl,int type) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 5671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x148; + WBUFL(buf,2)=bl->id; + WBUFW(buf,6)=0; + + clif->send(buf,packet_db[0x148].len,bl, type == 1 ? AREA : AREA_WOS); + if (disguised(bl)) { + struct map_session_data *sd = ((TBL_PC *)BL_UCAST_(bl)); + if (sd->fontcolor) { + WBUFL(buf,2)=-bl->id; + clif->send(buf,packet_db[0x148].len,bl, SELF); + } else { + clif->spawn(bl); + } + } +} + + + +void clif_map_property(struct map_session_data* sd, enum map_property property) +{ + int fd; + + do { if (((void)(sd), +# 5695 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5695 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x199].len); + WFIFOW(fd,0)=0x199; + WFIFOW(fd,2)=property; + WFIFOSET(fd,packet_db[0x199].len); +} + + + +void clif_map_type(struct map_session_data* sd, enum map_type type) { + int fd; + + do { if (((void)(sd), +# 5709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1D6].len); + WFIFOW(fd,0)=0x1D6; + WFIFOW(fd,2)=type; + WFIFOSET(fd,packet_db[0x1D6].len); +} + + + + +void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +{ + do { if (((void)(sd), +# 5723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(type == 2) { + int fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x19a].len); + WFIFOW(fd,0) = 0x19a; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = pvprank; + WFIFOL(fd,10) = pvpnum; + WFIFOSET(fd,packet_db[0x19a].len); + } else { + unsigned char buf[32]; + WBUFW(buf,0) = 0x19a; + WBUFL(buf,2) = sd->bl.id; + if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) + WBUFL(buf,6) = ((uint32)0xFFFFFFFFU); + else + WBUFL(buf,6) = pvprank; + WBUFL(buf,10) = pvpnum; + if (( (sd)->sc.option&OPTION_INVISIBLE ) || sd->disguise != -1) + clif->send(buf,packet_db[0x19a].len,&sd->bl,SELF); + else if(!type) + clif->send(buf,packet_db[0x19a].len,&sd->bl,AREA); + else + clif->send(buf,packet_db[0x19a].len,&sd->bl,ALL_SAMEMAP); + } +} + + + + +void clif_map_property_mapall(int mapid, enum map_property property) +{ + struct block_list bl; + unsigned char buf[16]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = mapid; + WBUFW(buf,0)=0x199; + WBUFW(buf,2)=property; + clif->send(buf,packet_db[0x199].len,&bl,ALL_SAMEMAP); +} + + + + + + + +void clif_refine(int fd, int fail, int index, int val) +{ + WFIFOHEAD(fd,packet_db[0x188].len); + WFIFOW(fd,0)=0x188; + WFIFOW(fd,2)=fail; + WFIFOW(fd,4)=index+2; + WFIFOW(fd,6)=val; + WFIFOSET(fd,packet_db[0x188].len); +} +# 5790 "../../../server-code/src/map/clif.c" +void clif_upgrademessage(int fd, int result, int item_id) +{ + WFIFOHEAD(fd,packet_db[0x223].len); + WFIFOW(fd,0)=0x223; + WFIFOL(fd,2)=result; + WFIFOW(fd,6)=item_id; + WFIFOSET(fd,packet_db[0x223].len); +} + + + + +void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) +{ + + struct map_session_data *ssd = +# 5805 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5805 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(nick), +# 5807 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5807 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 5808 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5808 "../../../server-code/src/map/clif.c" +)) return; } while(0); +# 5818 "../../../server-code/src/map/clif.c" + ssd = map->nick2sd(nick); + + WFIFOHEAD(fd, mes_len + (23 + 1) + 8); + WFIFOW(fd,0) = 0x97; + WFIFOW(fd,2) = mes_len + (23 + 1) + 8; + (strlib->safestrncpy_((WFIFOP(fd,4)),(nick),((23 + 1)))); + WFIFOL(fd,28) = (ssd && ( (ssd)->group->level ) == 99) ? 1 : 0; + (strlib->safestrncpy_((WFIFOP(fd,32)),(mes),(mes_len))); + WFIFOSET(fd,WFIFOW(fd,2)); + +} +# 5837 "../../../server-code/src/map/clif.c" +void clif_wis_end(int fd, int flag) { + struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : +# 5838 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 5838 "../../../server-code/src/map/clif.c" + ; + struct packet_wis_end p; + + if( !sd ) + return; + + p.PacketType = wisendType; + p.result = (char)flag; + + p.unknown = 0; + + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + + +void clif_solved_charname(int fd, int charid, const char* name) +{ + do { if (((void)(name), +# 5857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x194].len); + WFIFOW(fd,0)=0x194; + WFIFOL(fd,2)=charid; + (strlib->safestrncpy_((WFIFOP(fd,6)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x194].len); +} + + + +void clif_use_card(struct map_session_data *sd,int idx) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 5872 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5872 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.trading != 0) + return; + if (!pc->can_insert_card(sd, idx)) + return; + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x17b; + + for (i = c = 0; i < 100; i++) { + if (!pc->can_insert_card_into(sd, idx, i)) + continue; + WFIFOW(fd,4 + c * 2) = i + 2; + c++; + } + + if (!c) return; + + WFIFOW(fd,2) = 4 + c * 2; + WFIFOSET(fd, WFIFOW(fd,2)); +} + + + + + + +void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5904 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5904 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x17d].len); + WFIFOW(fd,0)=0x17d; + WFIFOW(fd,2)=idx_equip+2; + WFIFOW(fd,4)=idx_card+2; + WFIFOB(fd,6)=flag; + WFIFOSET(fd,packet_db[0x17d].len); +} + + + +void clif_item_identify_list(struct map_session_data *sd) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5922 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5922 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,100 * 2 + 4); + WFIFOW(fd,0)=0x177; + for(i=c=0;i<100;i++){ + if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ + WFIFOW(fd,c*2+4)=i+2; + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*2+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = MC_IDENTIFY; + sd->menuskill_val = c; + sd->state.workinprogress = 3; + } +} + + + +void clif_item_identified(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 5949 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5949 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x179].len); + WFIFOW(fd,0)=0x179; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x179].len); +} + + + +void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +{ + int i,c; + int fd; + + do { if (((void)(sd), +# 5966 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5966 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(dstsd), +# 5967 "../../../server-code/src/map/clif.c" 3 4 +0 +# 5967 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x1fc; + for (i = c = 0; i < 100; i++) { + int nameid = dstsd->status.inventory[i].nameid; + if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { + 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]); + c++; + } + } + if(c > 0) { + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = BS_REPAIRWEAPON; + sd->menuskill_val = dstsd->bl.id; + sd->menuskill_val2 = lv; + }else + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); +} +# 6000 "../../../server-code/src/map/clif.c" +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +{ + int fd; + + do { if (((void)(sd), +# 6004 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6004 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x1fe].len); + WFIFOW(fd,0)=0x1fe; + WFIFOW(fd,2)=idx+2; + WFIFOB(fd, 4)=flag; + WFIFOSET(fd,packet_db[0x1fe].len); + +} + + + +void clif_item_damaged(struct map_session_data* sd, unsigned short position) +{ + int fd; + + do { if (((void)(sd), +# 6022 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6022 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2bb].len); + WFIFOW(fd,0) = 0x2bb; + WFIFOW(fd,2) = position; + WFIFOL(fd,4) = sd->bl.id; + WFIFOSET(fd,packet_db[0x2bb].len); +} + + + +void clif_item_refine_list(struct map_session_data *sd) +{ + int i,c; + int fd; + uint16 skill_lv; + + do { if (((void)(sd), +# 6040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + skill_lv = pc->checkskill(sd,WS_WEAPONREFINE); + + fd=sd->fd; + + WFIFOHEAD(fd, 100 * 13 + 4); + WFIFOW(fd,0)=0x221; + for (i = c = 0; i < 100; i++) { + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + && (itemdb->search(sd->status.inventory[i].nameid)->wlv) >= 1 + && !sd->inventory_data[i]->flag.no_refine + && !(sd->status.inventory[i].equip&(EQP_HAND_R|EQP_HAND_L))){ + 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]); + c++; + } + } + WFIFOW(fd,2)=c*13+4; + WFIFOSET(fd,WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = WS_WEAPONREFINE; + sd->menuskill_val = skill_lv; + } +} + + + +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x147].len); + WFIFOW(fd,0)=0x147; + WFIFOW(fd,2)=skill_id; + WFIFOW(fd,4)=skill->get_inf(skill_id); + WFIFOW(fd,6)=0; + WFIFOW(fd,8)=skill_lv; + WFIFOW(fd,10)=skill->get_sp(skill_id,skill_lv); + WFIFOW(fd,12)=skill->get_range2(&sd->bl, skill_id,skill_lv); + (strlib->safestrncpy_((WFIFOP(fd,14)),(skill->get_name(skill_id)),((23 + 1)))); + WFIFOB(fd,38)=0; + WFIFOSET(fd,packet_db[0x147].len); +} + + + + +void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +{ + int view,fd; + unsigned char *buf; + int offset = 0; + + do { if (((void)(sd), +# 6099 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6099 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + if(n<0 || n>=100 || sd->status.cart[n].nameid<=0) + return; + + WFIFOHEAD(fd,packet_db[cartaddType].len); + buf=WFIFOP(fd,0); + WBUFW(buf,0)=cartaddType; + WBUFW(buf,2)=n+2; + WBUFL(buf,4)=amount; + if((view = (itemdb->search(sd->status.cart[n].nameid)->view_id)) > 0) + WBUFW(buf,8)=view; + else + WBUFW(buf,8)=sd->status.cart[n].nameid; + + WBUFB(buf,10)=(itemdb->search(sd->status.cart[n].nameid)->type); + offset = 1; + + WBUFB(buf,10+offset)=sd->status.cart[n].identify; + WBUFB(buf,11+offset)=sd->status.cart[n].attribute; + WBUFB(buf,12+offset)=sd->status.cart[n].refine; + clif->addcards(WBUFP(buf,13+offset), &sd->status.cart[n]); + + clif->add_random_options(WBUFP(buf,21+offset), &sd->status.cart[n]); + + WFIFOSET(fd,packet_db[cartaddType].len); +} + + + +void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +{ + int fd; + + do { if (((void)(sd), +# 6134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + + WFIFOHEAD(fd,packet_db[0x125].len); + WFIFOW(fd,0)=0x125; + WFIFOW(fd,2)=n+2; + WFIFOL(fd,4)=amount; + WFIFOSET(fd,packet_db[0x125].len); +} + + + + + +void clif_openvendingreq(struct map_session_data* sd, int num) +{ + int fd; + + do { if (((void)(sd), +# 6153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x12d].len); + WFIFOW(fd,0) = 0x12d; + WFIFOW(fd,2) = num; + WFIFOSET(fd,packet_db[0x12d].len); +} + + + +void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +{ + unsigned char buf[128]; + + do { if (((void)(bl), +# 6168 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6168 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x131; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(message),(80))); + + if( fd ) { + WFIFOHEAD(fd,packet_db[0x131].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x131].len); + WFIFOSET(fd,packet_db[0x131].len); + } else { + clif->send(buf,packet_db[0x131].len,bl,AREA_WOS); + } +} + + + +void clif_closevendingboard(struct block_list* bl, int fd) +{ + unsigned char buf[16]; + + do { if (((void)(bl), +# 6189 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6189 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x132; + WBUFL(buf,2) = bl->id; + if( fd ) { + WFIFOHEAD(fd,packet_db[0x132].len); + memcpy(WFIFOP(fd,0),buf,packet_db[0x132].len); + WFIFOSET(fd,packet_db[0x132].len); + } else { + clif->send(buf,packet_db[0x132].len,bl,AREA_WOS); + } +} + + + + +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { + int i,fd; + int count; + struct map_session_data* vsd; + + + + + const int cmd = 0x800; + const int offset = 12; + + + + const int item_length = 47; + + + + + do { if (((void)(sd), +# 6223 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6223 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vsd=map->id2sd(id)), +# 6225 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6225 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = vsd->vend_num; + + WFIFOHEAD(fd, offset+count*item_length); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = offset+count*item_length; + WFIFOL(fd,4) = id; + + WFIFOL(fd,8) = vsd->vender_id; + + + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); + WFIFOL(fd,offset+ 0+i*item_length) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*item_length) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*item_length) = vending_items[i].index + 2; + WFIFOB(fd,offset+ 8+i*item_length) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*item_length) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; + WFIFOB(fd,offset+11+i*item_length) = vsd->status.cart[index].identify; + WFIFOB(fd,offset+12+i*item_length) = vsd->status.cart[index].attribute; + WFIFOB(fd,offset+13+i*item_length) = vsd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->status.cart[index]); + + clif->add_random_options(WFIFOP(fd,offset+22+i*item_length), &vsd->status.cart[index]); + + } + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 6267 "../../../server-code/src/map/clif.c" +void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +{ + int fd; + + do { if (((void)(sd), +# 6271 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6271 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x135].len); + WFIFOW(fd,0) = 0x135; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOB(fd,6) = fail; + WFIFOSET(fd,packet_db[0x135].len); +} + + + +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { + int i,fd; + int count; + + + const int item_length = 47; + + + + + do { if (((void)(sd), +# 6294 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6294 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(vending_items), +# 6295 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6295 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + count = sd->vend_num; + + WFIFOHEAD(fd, 8+count*item_length); + WFIFOW(fd,0) = 0x136; + WFIFOW(fd,2) = 8+count*item_length; + WFIFOL(fd,4) = id; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; + struct item_data* data = itemdb->search(sd->status.cart[index].nameid); + WFIFOL(fd, 8+i*item_length) = vending_items[i].value; + WFIFOW(fd,12+i*item_length) = vending_items[i].index + 2; + WFIFOW(fd,14+i*item_length) = vending_items[i].amount; + WFIFOB(fd,16+i*item_length) = itemtype(data->type); + WFIFOW(fd,17+i*item_length) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; + WFIFOB(fd,19+i*item_length) = sd->status.cart[index].identify; + WFIFOB(fd,20+i*item_length) = sd->status.cart[index].attribute; + WFIFOB(fd,21+i*item_length) = sd->status.cart[index].refine; + clif->addcards(WFIFOP(fd,22+i*item_length), &sd->status.cart[index]); + + clif->add_random_options(WFIFOP(fd,30+22+i*item_length), &sd->status.cart[index]); + + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + + WFIFOHEAD(fd, 3); + WFIFOW(fd,0) = 0xa28; + WFIFOB(fd, 2) = 0; + WFIFOSET(fd, 3); + +} + + + +void clif_vendingreport(struct map_session_data* sd, int index, int amount) +{ + int fd; + + do { if (((void)(sd), +# 6337 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6337 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x137].len); + WFIFOW(fd,0) = 0x137; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOSET(fd,packet_db[0x137].len); +} +# 6355 "../../../server-code/src/map/clif.c" +void clif_party_created(struct map_session_data *sd,int result) +{ + int fd; + + do { if (((void)(sd), +# 6359 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6359 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xfa].len); + WFIFOW(fd,0)=0xfa; + WFIFOB(fd,2)=result; + WFIFOSET(fd,packet_db[0xfa].len); +} +# 6377 "../../../server-code/src/map/clif.c" +void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +{ + unsigned char buf[81]; + int i; + + do { if (((void)(p), +# 6382 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6382 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 6383 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6383 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (!sd) { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != 0) break; } while( +# 6385 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6385 "../../../server-code/src/map/clif.c" + ); + } else { + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 6387 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6387 "../../../server-code/src/map/clif.c" + ); + } + if (i >= 12) return; + sd = p->data[i].sd; + + WBUFW(buf,0) = 0x1e9; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = (p->party.member[i].leader)?0:1; + WBUFW(buf,10) = sd->bl.x; + WBUFW(buf,12) = sd->bl.y; + WBUFB(buf,14) = (p->party.member[i].online)?0:1; + memcpy(WBUFP(buf,15), p->party.name, (23 + 1)); + memcpy(WBUFP(buf,39), sd->status.name, (23 + 1)); + mapindex->getmapname_ext(map->list[sd->bl.m].custom_name ? map->list[map->list[sd->bl.m].instance_src_map].name : map->list[sd->bl.m].name, WBUFP(buf,63)); + WBUFB(buf,79) = (p->party.item&1)?1:0; + WBUFB(buf,80) = (p->party.item&2)?1:0; + clif->send(buf,packet_db[0x1e9].len,&sd->bl,PARTY); +} +# 6414 "../../../server-code/src/map/clif.c" +void clif_party_info(struct party_data* p, struct map_session_data *sd) +{ + unsigned char buf[2+2+(23 + 1)+(4+(23 + 1)+((11 + 1) + 4)+1+1)*12]; + struct map_session_data* party_sd = +# 6417 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6417 "../../../server-code/src/map/clif.c" + ; + int i, c; + + do { if (((void)(p), +# 6420 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6420 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0xfb; + memcpy(WBUFP(buf,4), p->party.name, (23 + 1)); + for(i = 0, c = 0; i < 12; i++) + { + struct party_member* m = &p->party.member[i]; + if(!m->account_id) continue; + + if(party_sd == +# 6429 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6429 "../../../server-code/src/map/clif.c" + ) party_sd = p->data[i].sd; + + WBUFL(buf,28+c*46) = m->account_id; + memcpy(WBUFP(buf,28+c*46+4), m->name, (23 + 1)); + mapindex->getmapname_ext(mapindex->id2name((m->map),"../../../server-code/src/map/clif.c", 6433, __func__), WBUFP(buf,28+c*46+28)); + WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1; + WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1; + c++; + } + WBUFW(buf,2) = 28+c*46; + + if(sd) { + clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + } else if (party_sd) { + clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY); + } +} + + + + + + +void clif_partyinvitationstate(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 6455 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6455 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2c9].len); + WFIFOW(fd,0) = 0x2c9; + WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOSET(fd, packet_db[0x2c9].len); +} + + + + +void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +{ + + + + const int cmd = 0x2c6; + + int fd; + struct party_data *p; + + do { if (((void)(sd), +# 6477 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6477 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 6478 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6478 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=tsd->fd; + + if( (p=party->search(sd->status.party_id))== +# 6482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6482 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0)=cmd; + WFIFOL(fd,2)=sd->status.party_id; + memcpy(WFIFOP(fd,6),p->party.name,(23 + 1)); + WFIFOSET(fd,packet_db[cmd].len); +} +# 6504 "../../../server-code/src/map/clif.c" +void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +{ + int fd; + do { if (((void)(sd), +# 6507 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6507 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nick), +# 6508 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6508 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd=sd->fd; +# 6525 "../../../server-code/src/map/clif.c" + WFIFOHEAD(fd,packet_db[0x2c5].len); + WFIFOW(fd,0) = 0x2c5; + (strlib->safestrncpy_((WFIFOP(fd,2)),(nick),((23 + 1)))); + WFIFOL(fd,26) = result; + WFIFOSET(fd,packet_db[0x2c5].len); + +} +# 6544 "../../../server-code/src/map/clif.c" +void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +{ + unsigned char buf[16]; + + + + const int cmd = 0x7d8; + + + do { if (((void)(p), +# 6553 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6553 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && flag==0){ + int i; + for(i=0;i<12 && !p->data[i].sd;i++) + ; + if (i < 12) + sd = p->data[i].sd; + } + if(!sd) return; + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=((flag&0x01)?2:p->party.exp); + + WBUFB(buf,6)=(p->party.item&1)?1:0; + WBUFB(buf,7)=(p->party.item&2)?1:0; + + if(flag==0) + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[cmd].len,&sd->bl,SELF); +} + + + + + + + +void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +{ + unsigned char buf[64]; + + do { if (((void)(p), +# 6585 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6585 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 6586 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6586 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!sd && (flag&0xf0)==0) { + int i; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd != +# 6591 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6591 "../../../server-code/src/map/clif.c" + ) break; } while( +# 6591 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 6591 "../../../server-code/src/map/clif.c" + ); + if (i != 12) + sd = p->data[i].sd; + } + + if (!sd) + return; + + WBUFW(buf,0)=0x105; + WBUFL(buf,2)=account_id; + memcpy(WBUFP(buf,6),name,(23 + 1)); + WBUFB(buf,30)=flag&0x0f; + if((flag&0xf0)==0) + clif->send(buf,packet_db[0x105].len,&sd->bl,PARTY); + else + clif->send(buf,packet_db[0x105].len,&sd->bl,SELF); +} + + + +void clif_party_message(struct party_data* p, int account_id, const char* mes, int len) +{ + struct map_session_data *sd; + int i; + + do { if (((void)(p), +# 6616 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6616 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 6617 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6617 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for(i=0; i < 12 && !p->data[i].sd;i++); + if(i < 12){ + unsigned char buf[1024]; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_party_message: Truncated message '%s' (len=%d, max=%""z" "u"", party_id=%d).\n"), mes, len, sizeof(buf)-8, p->party.party_id)) + ; + len = sizeof(buf)-8; + } + + sd = p->data[i].sd; + WBUFW(buf,0)=0x109; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=account_id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len))); + clif->send(buf,len+8,&sd->bl,PARTY); + } +} + + + +void clif_party_xy(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 6644 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6644 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} + + + + +void clif_party_xy_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 6658 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6658 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x107].len); + WFIFOW(fd,0)=0x107; + WFIFOL(fd,2)=sd->status.account_id; + WFIFOW(fd,6)=sd->bl.x; + WFIFOW(fd,8)=sd->bl.y; + WFIFOSET(fd,packet_db[0x107].len); +} + + + + +void clif_party_hp(struct map_session_data *sd) +{ + unsigned char buf[16]; + + + + const int cmd = 0x80e; + + + do { if (((void)(sd), +# 6679 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6679 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=cmd; + WBUFL(buf,2)=sd->status.account_id; +# 6692 "../../../server-code/src/map/clif.c" + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + + clif->send(buf,packet_db[cmd].len,&sd->bl,PARTY_AREA_WOS); +} + + + + +void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +{ + + + + const int cmd = 0x80e; + + WFIFOHEAD(fd,packet_db[cmd].len); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,2) = id; +# 6721 "../../../server-code/src/map/clif.c" + WFIFOL(fd,6) = hp; + WFIFOL(fd,10) = maxhp; + + WFIFOSET(fd, packet_db[cmd].len); +} + + + +void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +{ + int fd; + + do { if (((void)(sd), +# 6733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 6734 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6734 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x139].len); + WFIFOW(fd,0)=0x139; + WFIFOL(fd, 2)=bl->id; + WFIFOW(fd,6)=bl->x; + WFIFOW(fd,8)=bl->y; + WFIFOW(fd,10)=sd->bl.x; + WFIFOW(fd,12)=sd->bl.y; + WFIFOW(fd,14)=sd->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x139].len); +} +# 6755 "../../../server-code/src/map/clif.c" +void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 6759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + clif->solved_charname(fd, sd->status.char_id, sd->status.name); + WFIFOHEAD(fd,packet_db[0x18f].len); + WFIFOW(fd,0)=0x18f; + WFIFOW(fd,2)=flag; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,4)=view; + else + WFIFOW(fd,4)=nameid; + WFIFOSET(fd,packet_db[0x18f].len); +} + + + +void clif_catch_process(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 6779 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6779 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x19e].len); + WFIFOW(fd,0)=0x19e; + WFIFOSET(fd,packet_db[0x19e].len); +} + + + + + +void clif_pet_roulette(struct map_session_data *sd,int data) +{ + int fd; + + do { if (((void)(sd), +# 6795 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6795 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a0].len); + WFIFOW(fd,0)=0x1a0; + WFIFOB(fd,2)=data; + WFIFOSET(fd,packet_db[0x1a0].len); +} + + + +void clif_sendegg(struct map_session_data *sd) { + int i, n, fd; + + do { if (((void)(sd), +# 6809 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6809 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle)) { + clif->message(fd, atcommand->msgsd((sd),(866))); + return; + } + + WFIFOHEAD(fd, 100 * 2 + 4); + WFIFOW(fd,0) = 0x1a6; + for (i = n = 0; i < 100; i++) { + if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == +# 6820 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6820 "../../../server-code/src/map/clif.c" + || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) + continue; + WFIFOW(fd,n * 2 + 4) = i + 2; + n++; + } + + if (!n) return; + + WFIFOW(fd,2) = 4 + n * 2; + WFIFOSET(fd, WFIFOW(fd,2)); + + sd->menuskill_id = SA_TAMINGMONSTER; + sd->menuskill_val = -1; +} +# 6846 "../../../server-code/src/map/clif.c" +void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + do { if (((void)(pd), +# 6849 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6849 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + if (sd) + clif->send(buf, packet_db[0x1a4].len, &sd->bl, SELF); + else + clif->send(buf, packet_db[0x1a4].len, &pd->bl, AREA); +} + + + +void clif_send_petstatus(struct map_session_data *sd) +{ + int fd; + struct s_pet *p; + + do { if (((void)(sd), +# 6868 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6868 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd->pd), +# 6869 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6869 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + p = &sd->pd->pet; + WFIFOHEAD(fd,packet_db[0x1a2].len); + WFIFOW(fd,0)=0x1a2; + memcpy(WFIFOP(fd,2),p->name,(23 + 1)); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; + + WFIFOW(fd,35)=p->class_; + + WFIFOSET(fd,packet_db[0x1a2].len); +} + + + + + +void clif_pet_emotion(struct pet_data *pd,int param) +{ + unsigned char buf[16]; + + do { if (((void)(pd), +# 6895 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6895 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf,0,packet_db[0x1aa].len); + + WBUFW(buf,0)=0x1aa; + WBUFL(buf,2)=pd->bl.id; + if(param >= 100 && pd->petDB->talk_convert_class) { + if(pd->petDB->talk_convert_class < 0) + return; + else if(pd->petDB->talk_convert_class > 0) { + + param -= (pd->pet.class_ - 100)*100; + param += (pd->petDB->talk_convert_class - 100)*100; + } + } + WBUFL(buf,6)=param; + + clif->send(buf,packet_db[0x1aa].len,&pd->bl,AREA); +} + + + + + + +void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +{ + int fd; + + do { if (((void)(sd), +# 6924 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6924 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1a3].len); + WFIFOW(fd,0)=0x1a3; + WFIFOB(fd,2)=fail; + WFIFOW(fd,3)=foodid; + WFIFOSET(fd,packet_db[0x1a3].len); +} + + + +void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +{ + int fd; + + do { if (((void)(sd), +# 6940 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6940 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x1cd].len); + WFIFOW(fd,0)=0x1cd; + + if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) + WFIFOL(fd,2)= MG_NAPALMBEAT; + else + WFIFOL(fd,2)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) + WFIFOL(fd,6)= MG_COLDBOLT; + else + WFIFOL(fd,6)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) + WFIFOL(fd,10)= MG_FIREBOLT; + else + WFIFOL(fd,10)= 0x00000000; + if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) + WFIFOL(fd,14)= MG_LIGHTNINGBOLT; + else + WFIFOL(fd,14)= 0x00000000; + if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) + WFIFOL(fd,18)= MG_SOULSTRIKE; + else + WFIFOL(fd,18)= 0x00000000; + if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) + WFIFOL(fd,22)= MG_FIREBALL; + else + WFIFOL(fd,22)= 0x00000000; + if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) + WFIFOL(fd,26)= MG_FROSTDIVER; + else + WFIFOL(fd,26)= 0x00000000; + + WFIFOSET(fd,packet_db[0x1cd].len); + sd->menuskill_id = SA_AUTOSPELL; + sd->menuskill_val = skill_lv; +} + + + +void clif_devotion(struct block_list *src, struct map_session_data *tsd) +{ + unsigned char buf[56]; + + do { if (((void)(src), +# 6986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 6986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(buf,0,packet_db[0x1cf].len); + + WBUFW(buf,0) = 0x1cf; + WBUFL(buf,2) = src->id; + if( src->type == BL_MER ) + { + struct mercenary_data *md = ( ((src) == (struct block_list *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_MER)) ? (TBL_MER *) +# 6993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 6993 "../../../server-code/src/map/clif.c" + : (TBL_MER *)(src) ); + if( md && md->master && md->devotion_flag ) + WBUFL(buf,6) = md->master->bl.id; + + WBUFW(buf,26) = skill->get_range2(src, ML_DEVOTION, mercenary->checkskill(md, ML_DEVOTION)); + } + else + { + int i; + struct map_session_data *sd = ( ((src) == (struct block_list *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + || (src)->type != (BL_PC)) ? (TBL_PC *) +# 7002 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7002 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(src) ); + if( sd == +# 7003 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7003 "../../../server-code/src/map/clif.c" + ) + return; + + for( i = 0; i < 5; i++ ) + WBUFL(buf,6+4*i) = sd->devotion[i]; + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION)); + } + + if( tsd ) + clif->send(buf, packet_db[0x1cf].len, &tsd->bl, SELF); + else + clif->send(buf, packet_db[0x1cf].len, src, AREA); +} + + + + + + + +void clif_spiritball(struct block_list *bl) { + unsigned char buf[16]; + struct map_session_data *sd = ( ((bl) == (struct block_list *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 7025 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7025 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + struct homun_data *hd = ( ((bl) == (struct block_list *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_HOM)) ? (TBL_HOM *) +# 7026 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7026 "../../../server-code/src/map/clif.c" + : (TBL_HOM *)(bl) ); + + do { if (((void)(bl), +# 7028 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7028 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d0; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = 0; + switch(bl->type){ + case BL_PC: WBUFW(buf,6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf,6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_db[0x1d0].len, bl, AREA); +} + + + +void clif_combo_delay(struct block_list *bl,int wait) +{ + unsigned char buf[32]; + + do { if (((void)(bl), +# 7046 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7046 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d2; + WBUFL(buf,2)=bl->id; + WBUFL(buf,6)=wait; + clif->send(buf,packet_db[0x1d2].len,bl,AREA); +} + + + + + + +void clif_bladestop(struct block_list *src, int dst_id, int active) +{ + unsigned char buf[32]; + + do { if (((void)(src), +# 7063 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7063 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1d1; + WBUFL(buf,2)=src->id; + WBUFL(buf,6)=dst_id; + WBUFL(buf,10)=active; + + clif->send(buf,packet_db[0x1d1].len,src,AREA); +} + + + +void clif_mvp_effect(struct map_session_data *sd) +{ + unsigned char buf[16]; + + do { if (((void)(sd), +# 7079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x10c; + WBUFL(buf,2)=sd->bl.id; + clif->send(buf,packet_db[0x10c].len,&sd->bl,AREA); +} + + + +void clif_mvp_item(struct map_session_data *sd,int nameid) +{ + int view,fd; + + do { if (((void)(sd), +# 7092 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7092 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10a].len); + WFIFOW(fd,0)=0x10a; + if((view = (itemdb->search(nameid)->view_id)) > 0) + WFIFOW(fd,2)=view; + else + WFIFOW(fd,2)=nameid; + WFIFOSET(fd,packet_db[0x10a].len); +} + + + +void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +{ + int fd; + + do { if (((void)(sd), +# 7110 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7110 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x10b].len); + WFIFOW(fd,0)=0x10b; + WFIFOL(fd,2)=(((exp) >= ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + )) ? ( +# 7115 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7115 "../../../server-code/src/map/clif.c" + ) : ((exp) <= (0)) ? (0) : (exp)); + WFIFOSET(fd,packet_db[0x10b].len); +} + + + + + + +void clif_mvp_noitem(struct map_session_data* sd) +{ + int fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x10d].len); + WFIFOW(fd,0) = 0x10d; + WFIFOSET(fd,packet_db[0x10d].len); +} +# 7140 "../../../server-code/src/map/clif.c" +void clif_guild_created(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7144 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7144 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x167].len); + WFIFOW(fd,0)=0x167; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x167].len); +} + + + + +void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +{ + int ps,fd; + do { if (((void)(sd), +# 7159 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7159 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7160 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7160 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + ps=guild->getposition(g,sd); + WFIFOHEAD(fd,packet_db[0x16c].len); + WFIFOW(fd,0)=0x16c; + WFIFOL(fd,2)=g->guild_id; + WFIFOL(fd,6)=g->emblem_id; + WFIFOL(fd,10)=g->position[ps].mode; + WFIFOB(fd,14)=( +# 7169 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 7169 "../../../server-code/src/map/clif.c" + )(sd->state.gmaster_flag == 1); + WFIFOL(fd,15)=0; + memcpy(WFIFOP(fd,19),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16c].len); +} + + + + + + + +void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +{ + unsigned char buf[64]; + struct map_session_data* sd; + + do { if (((void)(g), +# 7186 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7186 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x1f2; + WBUFL(buf, 2)=g->member[idx].account_id; + WBUFL(buf, 6)=g->member[idx].char_id; + WBUFL(buf,10)=flag; + + if( ( sd = g->member[idx].sd ) != +# 7193 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7193 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = sd->status.sex; + WBUFW(buf,16) = sd->status.hair; + WBUFW(buf,18) = sd->status.hair_color; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD_WOS); + } + else if( ( sd = guild->getavailablesd(g) ) != +# 7200 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7200 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,14) = 0; + WBUFW(buf,16) = 0; + WBUFW(buf,18) = 0; + clif->send(buf,packet_db[0x1f2].len,&sd->bl,GUILD); + } +} +# 7218 "../../../server-code/src/map/clif.c" +void clif_guild_send_onlineinfo(struct map_session_data *sd) +{ + struct guild *g; + unsigned char buf[14*128]; + int i, count=0, p_len; + + do { if (((void)(sd), +# 7224 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7224 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + p_len = packet_db[0x16d].len; + + if(!(g = sd->guild)) + return; + + for(i=0; imax_member; i++) { + + if(g->member[i].account_id > 0 && + g->member[i].account_id != sd->status.account_id) { + + WBUFW(buf,count*p_len) = 0x16d; + WBUFL(buf,count*p_len+2) = g->member[i].account_id; + WBUFL(buf,count*p_len+6) = g->member[i].char_id; + WBUFL(buf,count*p_len+10) = g->member[i].online; + count++; + } + } + + clif->send(buf, p_len*count, &sd->bl, SELF); +} +# 7257 "../../../server-code/src/map/clif.c" +void clif_guild_masterormember(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 7261 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7261 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x14e].len); + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; + WFIFOSET(fd,packet_db[0x14e].len); +} + + + + +void clif_guild_basicinfo(struct map_session_data *sd) { + int fd; + struct guild *g; + + do { if (((void)(sd), +# 7277 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7277 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + if( (g = sd->guild) == +# 7280 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7280 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd,packet_db[0x1b6].len); + WFIFOW(fd,0)=0x1b6; + WFIFOL(fd, 2)=g->guild_id; + WFIFOL(fd, 6)=g->guild_lv; + WFIFOL(fd,10)=g->connect_member; + WFIFOL(fd,14)=g->max_member; + WFIFOL(fd,18)=g->average_lv; + WFIFOL(fd,22)=(uint32)(((g->exp) >= ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + )) ? ( +# 7290 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7290 "../../../server-code/src/map/clif.c" + ) : ((g->exp) <= (0)) ? (0) : (g->exp)); + WFIFOL(fd,26)=g->next_exp; + WFIFOL(fd,30)=0; + WFIFOL(fd,34)=0; + WFIFOL(fd,38)=0; + WFIFOL(fd,42)=g->emblem_id; + memcpy(WFIFOP(fd,46),g->name, (23 + 1)); + memcpy(WFIFOP(fd,70),g->master, (23 + 1)); + + (strlib->safestrncpy_((WFIFOP(fd,94)),(atcommand->msgsd((sd),(300+guild->checkcastles(g)))),(16))); + WFIFOL(fd,110) = 0; + + WFIFOSET(fd,packet_db[0x1b6].len); +} + + + +void clif_guild_allianceinfo(struct map_session_data *sd) +{ + int fd,i,c; + struct guild *g; + + do { if (((void)(sd), +# 7312 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7312 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7313 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7313 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 16 * 32 + 4); + WFIFOW(fd,0)=0x14c; + for(i=c=0;i<16;i++){ + struct guild_alliance *a=&g->alliance[i]; + if(a->guild_id>0){ + WFIFOL(fd,c*32+4)=a->opposition; + WFIFOL(fd,c*32+8)=a->guild_id; + memcpy(WFIFOP(fd,c*32+12),a->name,(23 + 1)); + c++; + } + } + WFIFOW(fd,2)=c*32+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 7339 "../../../server-code/src/map/clif.c" +void clif_guild_memberlist(struct map_session_data *sd) +{ + int fd; + int i,c; + struct guild *g; + do { if (((void)(sd), +# 7344 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7344 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (fd = sd->fd) == 0 ) + return; + if( (g = sd->guild) == +# 7348 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7348 "../../../server-code/src/map/clif.c" + ) + return; + + WFIFOHEAD(fd, g->max_member * 104 + 4); + WFIFOW(fd,0)=0x154; + for(i=0,c=0;imax_member;i++){ + struct guild_member *m=&g->member[i]; + if(m->account_id==0) + continue; + WFIFOL(fd,c*104+ 4)=m->account_id; + WFIFOL(fd,c*104+ 8)=m->char_id; + WFIFOW(fd,c*104+12)=m->hair; + WFIFOW(fd,c*104+14)=m->hair_color; + WFIFOW(fd,c*104+16)=m->gender; + WFIFOW(fd,c*104+18)=m->class_; + WFIFOW(fd,c*104+20)=m->lv; + WFIFOL(fd,c*104+22)=(int)(((m->exp) >= ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + )) ? ( +# 7364 "../../../server-code/src/map/clif.c" 3 4 + (2147483647) +# 7364 "../../../server-code/src/map/clif.c" + ) : ((m->exp) <= (0)) ? (0) : (m->exp)); + WFIFOL(fd,c*104+26)=m->online; + WFIFOL(fd,c*104+30)=m->position; + memset(WFIFOP(fd,c*104+34),0,50); + memcpy(WFIFOP(fd,c*104+84),m->name,(23 + 1)); + c++; + } + WFIFOW(fd,2)=c*104+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_positionnamelist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7381 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7381 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7382 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7382 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 28 + 4); + WFIFOW(fd,0)=0x166; + for(i=0;i<20;i++){ + WFIFOL(fd,i*28+4)=i; + memcpy(WFIFOP(fd,i*28+8),g->position[i].name,(23 + 1)); + } + WFIFOW(fd,2)=i*28+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positioninfolist(struct map_session_data *sd) { + int i,fd; + struct guild *g; + + do { if (((void)(sd), +# 7405 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7405 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7406 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7406 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 20 * 16 + 4); + WFIFOW(fd,0)=0x160; + for(i=0;i<20;i++){ + struct guild_position *p=&g->position[i]; + WFIFOL(fd,i*16+ 4)=i; + WFIFOL(fd,i*16+ 8)=p->mode; + WFIFOL(fd,i*16+12)=i; + WFIFOL(fd,i*16+16)=p->exp_mode; + } + WFIFOW(fd,2)=i*16+4; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_guild_positionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[128]; + + do { if (((void)(g), +# 7436 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7436 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x174; + WBUFW(buf,2)=44; + + WBUFL(buf, 4)=idx; + WBUFL(buf, 8)=g->position[idx].mode; + WBUFL(buf,12)=idx; + WBUFL(buf,16)=g->position[idx].exp_mode; + memcpy(WBUFP(buf,20),g->position[idx].name,(23 + 1)); + + if( (sd=guild->getavailablesd(g))!= +# 7447 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7447 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_memberpositionchanged(struct guild *g,int idx) +{ + + + + struct map_session_data *sd; + unsigned char buf[64]; + + do { if (((void)(g), +# 7461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x156; + WBUFW(buf,2)=16; + + WBUFL(buf, 4)=g->member[idx].account_id; + WBUFL(buf, 8)=g->member[idx].char_id; + WBUFL(buf,12)=g->member[idx].position; + + if( (sd=guild->getavailablesd(g))!= +# 7470 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7470 "../../../server-code/src/map/clif.c" + ) + clif->send(buf,WBUFW(buf,2),&sd->bl,GUILD); +} + + + +void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +{ + int fd; + do { if (((void)(sd), +# 7479 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7479 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7480 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7480 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if( g->emblem_len <= 0 ) + return; + + WFIFOHEAD(fd,g->emblem_len+12); + WFIFOW(fd,0)=0x152; + WFIFOW(fd,2)=g->emblem_len+12; + WFIFOL(fd,4)=g->guild_id; + WFIFOL(fd,8)=g->emblem_id; + memcpy(WFIFOP(fd,12),g->emblem_data,g->emblem_len); + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_emblem_area(struct block_list* bl) +{ + uint8 buf[12]; + + do { if (((void)(bl), +# 7501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7501 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + + + WBUFW(buf,0) = 0x1b4; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = status->get_guild_id(bl); + WBUFW(buf,10) = status->get_emblem_id(bl); + clif->send(buf, 12, bl, AREA_WOS); +} + + + +void clif_guild_skillinfo(struct map_session_data* sd) +{ + int fd; + struct guild* g; + int i,c; + + do { if (((void)(sd), +# 7520 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7520 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( (g = sd->guild) == +# 7521 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7521 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd, 6 + 15*37); + WFIFOW(fd,0) = 0x0162; + WFIFOW(fd,4) = g->skill_point; + for(i = 0, c = 0; i < 15; i++) { + if(g->skill[i].id > 0 && guild->check_skill_require(g, g->skill[i].id)) { + int id = g->skill[i].id; + int p = 6 + c*37; + WFIFOW(fd,p+0) = id; + WFIFOL(fd,p+2) = skill->get_inf(id); + WFIFOW(fd,p+6) = g->skill[i].lv; + if ( g->skill[i].lv ) { + WFIFOW(fd,p + 8) = skill->get_sp(id, g->skill[i].lv); + WFIFOW(fd,p + 10) = skill->get_range(id, g->skill[i].lv); + } else { + WFIFOW(fd,p + 8) = 0; + WFIFOW(fd,p + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,p+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,p+36)= (g->skill[i].lv < guild->skill_get_max(id) && sd == g->member[0].sd) ? 1 : 0; + c++; + } + } + WFIFOW(fd,2) = 6 + c*37; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_notice(struct map_session_data* sd, struct guild* g) +{ + int fd; + + do { if (((void)(sd), +# 7557 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7557 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7558 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7558 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + if (!sockt->session_is_active(fd)) + return; + + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') + return; + + WFIFOHEAD(fd,packet_db[0x16f].len); + WFIFOW(fd,0) = 0x16f; + memcpy(WFIFOP(fd,2), g->mes1, 60); + memcpy(WFIFOP(fd,62), g->mes2, 120); + WFIFOSET(fd,packet_db[0x16f].len); +} + + + +void clif_guild_invite(struct map_session_data *sd,struct guild *g) +{ + int fd; + + do { if (((void)(sd), +# 7581 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7581 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(g), +# 7582 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7582 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x16a].len); + WFIFOW(fd,0)=0x16a; + WFIFOL(fd,2)=g->guild_id; + memcpy(WFIFOP(fd,6),g->name,(23 + 1)); + WFIFOSET(fd,packet_db[0x16a].len); +} +# 7599 "../../../server-code/src/map/clif.c" +void clif_guild_inviteack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7603 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7603 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x169].len); + WFIFOW(fd,0)=0x169; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x169].len); +} + + + +void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +{ + unsigned char buf[128]; + + do { if (((void)(sd), +# 7618 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7618 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x15a; + memcpy(WBUFP(buf, 2),name,(23 + 1)); + memcpy(WBUFP(buf,26),mes,40); + clif->send(buf,packet_db[0x15a].len,&sd->bl,GUILD_NOBG); +} + + + + +void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +{ + unsigned char buf[128]; + + + + const unsigned short cmd = 0x839; + + + do { if (((void)(sd), +# 7638 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7638 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7639 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7639 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7640 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7640 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + (strlib->safestrncpy_((WBUFP(buf,26)),(mes),(40))); + + + + clif->send(buf, packet_db[cmd].len, &sd->bl, GUILD_NOBG); +} + + + + +void clif_guild_expulsionlist(struct map_session_data* sd) { + + + + const int offset = (23 + 1)+40; + + int fd, i, c = 0; + struct guild* g; + + do { if (((void)(sd), +# 7663 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7663 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( (g = sd->guild) == +# 7665 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7665 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + + WFIFOHEAD(fd,4 + 32 * offset); + WFIFOW(fd,0) = 0x163; + + for( i = 0; i < 32; i++ ) + { + struct guild_expulsion* e = &g->expulsion[i]; + + if( e->account_id > 0 ) + { + memcpy(WFIFOP(fd,4 + c*offset), e->name, (23 + 1)); + + + + + memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + + c++; + } + } + WFIFOW(fd,2) = 4 + c*offset; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +{ + struct map_session_data *sd; + uint8 buf[256]; + + do { if (((void)(mes), +# 7700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (len == 0) + return; + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_guild_message: Truncated message '%s' (len=%d, max=%""z" "u"", guild_id=%d).\n"), mes, len, sizeof(buf)-5, g->guild_id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + + if ((sd = guild->getavailablesd(g)) != +# 7713 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7713 "../../../server-code/src/map/clif.c" + ) + clif->send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); +} + + + +void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +{ + int fd; + + do { if (((void)(sd), +# 7723 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7723 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 7724 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7724 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x171].len); + WFIFOW(fd,0)=0x171; + WFIFOL(fd,2)=account_id; + memcpy(WFIFOP(fd,6),name,(23 + 1)); + WFIFOSET(fd,packet_db[0x171].len); +} +# 7743 "../../../server-code/src/map/clif.c" +void clif_guild_allianceack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7747 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7747 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x173].len); + WFIFOW(fd,0)=0x173; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x173].len); +} + + + + + + +void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7765 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7765 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + if (fd <= 0) + return; + WFIFOHEAD(fd,packet_db[0x184].len); + WFIFOW(fd,0)=0x184; + WFIFOL(fd,2)=guild_id; + WFIFOL(fd,6)=flag; + WFIFOSET(fd,packet_db[0x184].len); +} +# 7784 "../../../server-code/src/map/clif.c" +void clif_guild_oppositionack(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7788 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7788 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x181].len); + WFIFOW(fd,0)=0x181; + WFIFOB(fd,2)=flag; + WFIFOSET(fd,packet_db[0x181].len); +} +# 7816 "../../../server-code/src/map/clif.c" +void clif_guild_broken(struct map_session_data *sd,int flag) +{ + int fd; + + do { if (((void)(sd), +# 7820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x15e].len); + WFIFOW(fd,0)=0x15e; + WFIFOL(fd,2)=flag; + WFIFOSET(fd,packet_db[0x15e].len); +} + + + + + +void clif_emotion(struct block_list *bl,int type) +{ + unsigned char buf[8]; + + do { if (((void)(bl), +# 7837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0xc0; + WBUFL(buf,2)=bl->id; + WBUFB(buf,6)=type; + clif->send(buf,packet_db[0xc0].len,bl,AREA); +} + + + +void clif_talkiebox(struct block_list* bl, const char* talkie) +{ + unsigned char buf[(79 + 1)+6]; + do { if (((void)(bl), +# 7850 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7850 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(talkie), +# 7851 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7851 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x191; + WBUFL(buf,2) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,6)),(talkie),((79 + 1)))); + clif->send(buf,packet_db[0x191].len,bl,AREA); +} + + + +void clif_wedding_effect(struct block_list *bl) +{ + unsigned char buf[6]; + + do { if (((void)(bl), +# 7865 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7865 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1ea; + WBUFL(buf,2) = bl->id; + clif->send(buf, packet_db[0x1ea].len, bl, AREA); +} + + + +void clif_callpartner(struct map_session_data *sd) { + unsigned char buf[26]; + + do { if (((void)(sd), +# 7877 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7877 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1e6; + + if( sd->status.partner_id ) { + const char *p; + if( ( p = map->charid2nick(sd->status.partner_id) ) != +# 7883 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 7883 "../../../server-code/src/map/clif.c" + ) { + memcpy(WBUFP(buf,2), p, (23 + 1)); + } else { + WBUFB(buf,2) = 0; + } + } else { + + WBUFB(buf,2) = 0; + } + + clif->send(buf, packet_db[0x1e6].len, &sd->bl, AREA); +} +# 7914 "../../../server-code/src/map/clif.c" +void clif_divorced(struct map_session_data* sd, const char* name) +{ + int fd; + do { if (((void)(sd), +# 7917 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7917 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0x205].len); + WFIFOW(fd,0)=0x205; + memcpy(WFIFOP(fd,2), name, (23 + 1)); + WFIFOSET(fd, packet_db[0x205].len); +} +# 7946 "../../../server-code/src/map/clif.c" +void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target) +{ + unsigned char buf[256]; + + if (len == 0) + return; + + do { if (((void)(src), +# 7953 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7953 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 7954 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7954 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (len > sizeof(buf)-5) { + (showmsg->showWarning(("clif_disp_message: Truncated message '%s' (len=%""z" "u"", max=%""z" "u"", aid=%d).\n"), mes, len, sizeof(buf)-5, src->id)); + len = sizeof(buf)-5; + } + + WBUFW(buf,0) = 0x17f; + WBUFW(buf,2) = len + 5; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len+1))); + clif->send(buf, WBUFW(buf,2), src, target); +} + + + + + + + +void clif_GM_kickack(struct map_session_data *sd, int result) +{ + int fd; + + do { if (((void)(sd), +# 7977 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7977 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcd].len); + WFIFOW(fd,0) = 0xcd; + WFIFOB(fd,2) = result; + WFIFOSET(fd, packet_db[0xcd].len); +} + +void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { + int fd; + + do { if (((void)(tsd), +# 7989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 7989 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = tsd->fd; + + if (fd > 0) + clif->authfail_fd(fd, 15); + else + map->quit(tsd); + + if (sd) + clif->GM_kickack(sd, 1); +} +# 8010 "../../../server-code/src/map/clif.c" +void clif_manner_message(struct map_session_data* sd, uint32 type) +{ + int fd; + do { if (((void)(sd), +# 8013 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8013 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x14a].len); + WFIFOW(fd,0) = 0x14a; + WFIFOL(fd,2) = type; + WFIFOSET(fd, packet_db[0x14a].len); +} + + + + + + +void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +{ + int fd; + do { if (((void)(sd), +# 8030 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8030 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8031 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8031 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = tsd->fd; + WFIFOHEAD(fd,packet_db[0x14b].len); + WFIFOW(fd,0) = 0x14b; + WFIFOB(fd,2) = type; + (strlib->safestrncpy_((WFIFOP(fd,3)),(sd->status.name),((23 + 1)))); + WFIFOSET(fd, packet_db[0x14b].len); +} +# 8050 "../../../server-code/src/map/clif.c" +void clif_wisexin(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8053 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8053 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd1].len); + WFIFOW(fd,0)=0xd1; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd1].len); +} +# 8071 "../../../server-code/src/map/clif.c" +void clif_wisall(struct map_session_data *sd,int type,int flag) { + int fd; + + do { if (((void)(sd), +# 8074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd=sd->fd; + WFIFOHEAD(fd,packet_db[0xd2].len); + WFIFOW(fd,0)=0xd2; + WFIFOB(fd,2)=type; + WFIFOB(fd,3)=flag; + WFIFOSET(fd,packet_db[0xd2].len); +} + + + +void clif_playBGM(struct map_session_data* sd, const char* name) +{ + int fd; + + do { if (((void)(sd), +# 8090 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8090 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7fe].len); + WFIFOW(fd,0) = 0x7fe; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOSET(fd,packet_db[0x7fe].len); +} +# 8112 "../../../server-code/src/map/clif.c" +void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +{ + int fd; + + do { if (((void)(sd), +# 8116 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8116 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 8117 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8117 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8118 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8118 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1d3].len); + WFIFOW(fd,0) = 0x1d3; + (strlib->safestrncpy_((WFIFOP(fd,2)),(name),((23 + 1)))); + WFIFOB(fd,26) = type; + WFIFOL(fd,27) = 0; + WFIFOL(fd,31) = bl->id; + WFIFOSET(fd,packet_db[0x1d3].len); +} + +void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +{ + unsigned char buf[40]; + + do { if (((void)(bl), +# 8134 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8134 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 8135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x1d3; + (strlib->safestrncpy_((WBUFP(buf,2)),(name),((23 + 1)))); + WBUFB(buf,26) = type; + WBUFL(buf,27) = 0; + WBUFL(buf,31) = bl->id; + clif->send(buf, packet_db[0x1d3].len, bl, coverage); +} + + + + + +void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +{ + unsigned char buf[24]; + + do { if (((void)(bl), +# 8153 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8153 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + memset(buf, 0, packet_db[0x1f3].len); + + WBUFW(buf,0) = 0x1f3; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = type; + + clif->send(buf, packet_db[0x1f3].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1f3].len, bl, SELF); + } +} + +void clif_specialeffect_single(struct block_list* bl, int type, int fd) { + do { if (((void)(bl), +# 8170 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8170 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x1f3; + WFIFOL(fd,2) = bl->id; + WFIFOL(fd,6) = type; + WFIFOSET(fd,10); +} + + + + + + + +void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +{ + uint8 buf[14]; + + WBUFW(buf,0) = 0x284; + WBUFL(buf,2) = bl->id; + WBUFL(buf,6) = effect_id; + WBUFL(buf,10) = num; + + clif->send(buf, packet_db[0x284].len, bl, target); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x284].len, bl, SELF); + } +} +# 8210 "../../../server-code/src/map/clif.c" +void clif_messagecolor_self(int fd, uint32 color, const char *msg) +{ + size_t msg_len; + + do { if (((void)(msg), +# 8214 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8214 "../../../server-code/src/map/clif.c" +)) return; } while(0); + msg_len = strlen(msg) + 1; + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(msg),(msg_len))); + WFIFOSET(fd, msg_len + 12); +} +# 8235 "../../../server-code/src/map/clif.c" +void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg) +{ + size_t msg_len = strlen(msg) + 1; + uint8 buf[256]; + + do { if (((void)(bl), +# 8240 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8240 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8241 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8241 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (msg_len > sizeof(buf)-12) { + (showmsg->showWarning(("clif_messagecolor: Truncating too long message '%s' (len=%""z" "u"").\n"), msg, msg_len)); + msg_len = sizeof(buf)-12; + } + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = bl->id; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + memcpy(WBUFP(buf,12), msg, msg_len); + + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); +} + + + + + + + +void clif_refresh_storagewindow(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8265 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8265 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { + storage->sortitem(sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->storagelist(sd, sd->status.storage.items, ( (int)(sizeof(sd->status.storage.items)/sizeof((sd->status.storage.items)[0])) )); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, 600); + } + + + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) { + struct guild_storage *gstor; + if( (gstor = ( DB->data2ptr((gstorage->db)->get((gstorage->db),DB->i2key(sd->status.guild_id))) )) == +# 8276 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8276 "../../../server-code/src/map/clif.c" + ) { + + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->storagelist(sd, gstor->items, ( (int)(sizeof(gstor->items)/sizeof((gstor->items)[0])) )); + clif->updatestorageamount(sd, gstor->storage_amount, 600); + } + } +} + + +void clif_refresh(struct map_session_data *sd) +{ + do { if (((void)(sd), +# 8290 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8290 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + if (sd->spiritball) + clif->spiritball_single(sd->fd, sd); + if (sd->charm_type != CHARM_TYPE_NONE && sd->charm_count > 0) + clif->charm_single(sd->fd, sd); + + if (sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + clif->send_homdata(sd,SP_ACK,0); + if( sd->md ) { + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + } + if( sd->ed ) + clif->elemental_info(sd); + map->foreachinrange(clif->getareachar,&sd->bl,(battle->bc->area_size),BL_ALL,sd); + clif->weather_check(sd); + if( sd->chatID ) + chat->leave(sd, +# 8326 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8326 "../../../server-code/src/map/clif.c" + ); + if( sd->state.vending ) + clif->openvending(sd, sd->bl.id, sd->vending); + if( ( (sd)->vd.dead_sit == 2 ) ) + clif->sitting(&sd->bl); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + else + clif->changed_dir(&sd->bl, SELF); + + + buyingstore->close(sd); + + mail->clear(sd); + + if( disguised(&sd->bl) ) { + short disguise = sd->disguise; + pc->disguise(sd, -1); + pc->disguise(sd, disguise); + } + + clif->refresh_storagewindow(sd); +} + + + + +void clif_charnameack (int fd, struct block_list *bl) +{ + unsigned char buf[103]; + int cmd = 0x95; + + do { if (((void)(bl), +# 8358 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8358 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = bl->id; + + switch( bl->type ) { + case BL_PC: + { + const struct map_session_data *ssd = ((const TBL_PC *)BL_UCCAST_(bl)); + const struct party_data *p = +# 8367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8367 "../../../server-code/src/map/clif.c" + ; + const struct guild *g = +# 8368 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8368 "../../../server-code/src/map/clif.c" + ; + int ps = -1; + + + if (ssd->fd == fd && ssd->disguise != -1) + WBUFL(buf,2) = -bl->id; + + if (ssd->fakename[0] != '\0') { + WBUFW(buf,0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, (23 + 1)); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; + } + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (ssd->status.party_id != 0) { + p = party->search(ssd->status.party_id); + } + if (ssd->status.guild_id != 0) { + if ((g = ssd->guild) != +# 8387 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8387 "../../../server-code/src/map/clif.c" + ) { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8389 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8389 "../../../server-code/src/map/clif.c" + ); + if (i < g->max_member) + ps = g->member[i].position; + } + } + + if (!battle_config.display_party_name && g == +# 8395 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8395 "../../../server-code/src/map/clif.c" + ) { + + p = +# 8397 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8397 "../../../server-code/src/map/clif.c" + ; + } + + if (p == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + && g == +# 8400 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8400 "../../../server-code/src/map/clif.c" + ) + break; + + WBUFW(buf,0) = cmd = 0x195; + if (p != +# 8404 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8404 "../../../server-code/src/map/clif.c" + ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if (g != +# 8409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8409 "../../../server-code/src/map/clif.c" + && ps >= 0 && ps < 20) { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } else { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + break; + + case BL_HOM: + memcpy(WBUFP(buf,6), ((const TBL_HOM *)BL_UCCAST_(bl))->homunculus.name, (23 + 1)); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((const TBL_MER *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((const TBL_PET *)BL_UCCAST_(bl))->pet.name, (23 + 1)); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((const TBL_NPC *)BL_UCCAST_(bl))->name, (23 + 1)); + break; + case BL_MOB: + { + const struct mob_data *md = ((const TBL_MOB *)BL_UCCAST_(bl)); + + memcpy(WBUFP(buf,6), md->name, (23 + 1)); + if (md->guardian_data && md->guardian_data->g) { + WBUFW(buf,0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->g->name, (23 + 1)); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, (23 + 1)); + } 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: %u%% | ", get_percentage(md->status.hp, md->status.max_hp)); + + + if (str_p != mobhp) { + *(str_p-3) = '\0'; + memcpy(WBUFP(buf,30), mobhp, (23 + 1)); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: + + + + + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((const TBL_ELEM *)BL_UCCAST_(bl))->db->name, (23 + 1)); + break; + default: + (showmsg->showError(("clif_charnameack: bad type %u(%d)\n"), bl->type, bl->id)); + return; + } + + + if (fd == 0) { + clif->send(buf, packet_db[cmd].len, bl, AREA); + } else { + WFIFOHEAD(fd, packet_db[cmd].len); + memcpy(WFIFOP(fd, 0), buf, packet_db[cmd].len); + WFIFOSET(fd, packet_db[cmd].len); + } +} + + + +void clif_charnameupdate (struct map_session_data *ssd) +{ + unsigned char buf[103]; + int cmd = 0x195, ps = -1; + struct party_data *p = +# 8491 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8491 "../../../server-code/src/map/clif.c" + ; + struct guild *g = +# 8492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8492 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(ssd), +# 8494 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8494 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( ssd->fakename[0] ) + return; + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = ssd->bl.id; + + memcpy(WBUFP(buf,6), ssd->status.name, (23 + 1)); + + if (!battle_config.display_party_name) { + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != +# 8505 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8505 "../../../server-code/src/map/clif.c" + ) + 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 = ssd->guild) != +# 8512 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8512 "../../../server-code/src/map/clif.c" + ) + { + int i; + do { for ((i) = (0); (i) < (g->max_member); ++(i)) if (g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id) break; } while( +# 8515 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8515 "../../../server-code/src/map/clif.c" + ); + if( i < g->max_member ) ps = g->member[i].position; + } + + if( p ) + memcpy(WBUFP(buf,30), p->party.name, (23 + 1)); + else + WBUFB(buf,30) = 0; + + if( g && ps >= 0 && ps < 20 ) + { + memcpy(WBUFP(buf,54), g->name,(23 + 1)); + memcpy(WBUFP(buf,78), g->position[ps].name, (23 + 1)); + } + else + { + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + + + clif->send(buf, packet_db[cmd].len, &ssd->bl, AREA); +} + + + + + + + +void clif_slide(struct block_list *bl, int x, int y) +{ + unsigned char buf[10]; + do { if (((void)(bl), +# 8548 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8548 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x01ff; + WBUFL(buf, 2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + clif->send(buf, packet_db[0x1ff].len, bl, AREA); + + if( disguised(bl) ) + { + WBUFL(buf,2) = -bl->id; + clif->send(buf, packet_db[0x1ff].len, bl, SELF); + } +} + + + +void clif_disp_overhead(struct block_list *bl, const char* mes) +{ + unsigned char buf[256]; + size_t len_mes; + + do { if (((void)(bl), +# 8570 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8570 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 8571 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8571 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len_mes = strlen(mes)+1; + + if (len_mes > sizeof(buf)-8) { + (showmsg->showError(("clif_disp_overhead: Message too long (length %""z" "u"")\n"), len_mes)); + len_mes = sizeof(buf)-8; + } + + WBUFW(buf,0) = 0x8d; + WBUFW(buf,2) = len_mes + 8; + WBUFL(buf,4) = bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); + + + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf,2) = len_mes + 4; + (strlib->safestrncpy_((WBUFP(buf,4)),(mes),(len_mes))); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + +} + + + + + +void clif_party_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[16]; + do { if (((void)(sd), +# 8602 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8602 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->status.account_id; + WBUFW(buf,6)=-1; + WBUFW(buf,8)=-1; + clif->send(buf,packet_db[0x107].len,&sd->bl,PARTY_SAMEMAP_WOS); +} +# 8625 "../../../server-code/src/map/clif.c" +void clif_gospel_info(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 8629 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8629 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x215].len); + WFIFOW(fd,0)=0x215; + WFIFOL(fd,2)=type; + WFIFOSET(fd, packet_db[0x215].len); + +} +# 8666 "../../../server-code/src/map/clif.c" +void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +{ + int fd; + + do { if (((void)(sd), +# 8670 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8670 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mapname), +# 8671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x20e].len); + WFIFOW(fd,0) = 0x20e; + (strlib->safestrncpy_((WFIFOP(fd,2)),(mapname),((23 + 1)))); + WFIFOL(fd,26) = monster_id; + WFIFOB(fd,30) = star; + WFIFOB(fd,31) = result; + WFIFOSET(fd,packet_db[0x20e].len); +} + + + + + +void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +{ + char mapname[((11 + 1) + 4)]; + + do { if (((void)(sd), +# 8691 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8691 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (feel_level < 3) ? +# 8692 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8692 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 8692, __func__, "feel_level < 3", "failed assertion"), +# 8692 "../../../server-code/src/map/clif.c" 3 4 +1 +# 8692 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + mapindex->getmapname_ext(mapindex->id2name((sd->feel_map[feel_level].index),"../../../server-code/src/map/clif.c", 8693, __func__), mapname); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); +} + + + + + +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +{ + if( pc->db_checkid(class_) ) { + clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mob->db_checkid(class_) ) { + clif->starskill(sd, mob->db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { + (showmsg->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)); + } +} + + + + +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); +} + + + + +void clif_feel_hate_reset(struct map_session_data *sd) +{ + clif->starskill(sd, "", 0, 0, 30); +} +# 8735 "../../../server-code/src/map/clif.c" +void clif_equiptickack(struct map_session_data* sd, int flag) +{ + int fd; + do { if (((void)(sd), +# 8738 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8738 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2d9].len); + WFIFOW(fd,0) = 0x2d9; + WFIFOL(fd, 2) = 0; + WFIFOL(fd, 6) = flag; + WFIFOSET(fd, packet_db[0x2d9].len); +} + + + + + + +void clif_equpcheckbox(struct map_session_data* sd) +{ + int fd; + do { if (((void)(sd), +# 8756 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8756 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x2da].len); + WFIFOW(fd,0) = 0x2da; + WFIFOB(fd, 2) = (sd->status.show_equip ? 1 : 0); + WFIFOSET(fd, packet_db[0x2da].len); +} + + + + + + +void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { + int i, equip = 0; + + do { if (((void)(sd), +# 8773 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8773 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(tsd), +# 8774 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8774 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + for (i = 0; i < EQI_MAX; i++) { + int k = tsd->equip_index[i]; + if (k >= 0) { + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == +# 8779 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8779 "../../../server-code/src/map/clif.c" + ) + continue; + + clif->item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); + } + } + + viewequip_list.PacketType = viewequipackType; + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + + (strlib->safestrncpy_((viewequip_list.characterName),(tsd->status.name),((23 + 1)))); + + viewequip_list.job = tsd->status.class_; + viewequip_list.head = tsd->vd.hair_style; + viewequip_list.accessory = tsd->vd.head_bottom; + viewequip_list.accessory2 = tsd->vd.head_mid; + viewequip_list.accessory3 = tsd->vd.head_top; + + viewequip_list.robe = tsd->vd.robe; + + viewequip_list.headpalette = tsd->vd.hair_color; + viewequip_list.bodypalette = tsd->vd.cloth_color; + viewequip_list.sex = tsd->vd.sex; + + clif->send(&viewequip_list, viewequip_list.PacketLength, &sd->bl, SELF); +} +# 8814 "../../../server-code/src/map/clif.c" +void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +{ + int fd; + do { if (((void)(sd), +# 8817 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8817 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x291].len); + WFIFOW(fd,0) = 0x291; + WFIFOW(fd,2) = msg_id; + WFIFOSET(fd, packet_db[0x291].len); +} +# 8835 "../../../server-code/src/map/clif.c" +void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +{ + + int fd; + do { if (((void)(sd), +# 8839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e2].len); + WFIFOW(fd,0) = 0x7e2; + WFIFOW(fd,2) = msg_id; + WFIFOL(fd, 4) = value; + WFIFOSET(fd, packet_db[0x7e2].len); + +} +# 8862 "../../../server-code/src/map/clif.c" +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +{ + int fd; + + do { if (((void)(sd), +# 8866 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8866 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7e6].len); + WFIFOW(fd,0) = 0x7e6; + WFIFOW(fd,2) = skill_id; + WFIFOL(fd,4) = msg_id; + WFIFOSET(fd, packet_db[0x7e6].len); +} + + + + + + +# 8880 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 8880 "../../../server-code/src/map/clif.c" + clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) +{ + const char *text, *name, *message; + unsigned int packetlen, textlen; + size_t namelen, messagelen; + int fd = sd->fd; + + do { if (((void)(sd), +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +)) return( +# 8887 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8887 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(name_), +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +)) return( +# 8888 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8888 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(namelen_), +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +)) return( +# 8889 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8889 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(message_), +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +)) return( +# 8890 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8890 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(messagelen_), +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +)) return( +# 8891 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8891 "../../../server-code/src/map/clif.c" +); } while(0); + + *name_ = +# 8893 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8893 "../../../server-code/src/map/clif.c" + ; + *namelen_ = 0; + *message_ = +# 8895 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8895 "../../../server-code/src/map/clif.c" + ; + *messagelen_ = 0; + + packetlen = RFIFOW(fd,2); + + if (packetlen < 4 + 1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (no message data)!\n"), sd->status.name)); + return +# 8903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8903 "../../../server-code/src/map/clif.c" + ; + } + + text = RFIFOP(fd,4); + textlen = packetlen - 4; + + + if( format == 0 ) + { + + name = text; + namelen = (strlib->strnlen_((sd->status.name),((23 + 1)-1))); + + if( strncmp(name, sd->status.name, namelen) || + name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) + { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n"), sd->status.name)); + sockt->eof(fd); + return +# 8922 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8922 "../../../server-code/src/map/clif.c" + ; + } + + message = name + namelen + 3; + messagelen = textlen - namelen - 3; + } + else + { + if( textlen < (23 + 1) + 1 ) + { + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n"), sd->status.name)); + return +# 8933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8933 "../../../server-code/src/map/clif.c" + ; + } + + + name = text; + namelen = (strlib->strnlen_((name),((23 + 1)-1))); + + if (name[namelen] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated name!\n"), sd->status.name)); + return +# 8943 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8943 "../../../server-code/src/map/clif.c" + ; + } + + message = name + (23 + 1); + messagelen = textlen - (23 + 1); + } + + if (messagelen != (strlib->strnlen_((message),(messagelen)))+1) { + + (showmsg->showWarning(("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n"), sd->status.name)); + return +# 8953 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8953 "../../../server-code/src/map/clif.c" + ; + } + + if (message[messagelen-1] != '\0') { + + (showmsg->showWarning(("clif_process_message: Player '%s' sent an unterminated message string!\n"), sd->status.name)); + return +# 8959 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8959 "../../../server-code/src/map/clif.c" + ; + } + if (messagelen > (255 + 1)-1) { + + + + + + (showmsg->showWarning(("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n"), sd->status.name, (255 + 1)-1, message)); + return +# 8968 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 8968 "../../../server-code/src/map/clif.c" + ; + } + + *name_ = name; + *namelen_ = namelen; + *message_ = message; + *messagelen_ = messagelen; + return +# 8975 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 8975 "../../../server-code/src/map/clif.c" + ; +} + +void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 8985 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8985 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 8986 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8986 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 8987 "../../../server-code/src/map/clif.c" 3 4 +0 +# 8987 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + 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) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(sd->fd,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 8999 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 8999 "../../../server-code/src/map/clif.c" + )) )) { + 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); + + ( (iter)->destroy(iter) ); +} + +void clif_channel_msg2(struct channel_data *chan, char *msg) +{ + struct DBIterator *iter; + struct map_session_data *user; + unsigned char buf[210]; + unsigned short msg_len; + uint32 color; + + do { if (((void)(chan), +# 9020 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9020 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(msg), +# 9021 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9021 "../../../server-code/src/map/clif.c" +)) return; } while(0); + iter = ( (chan->users)->iterator(chan->users) ); + msg_len = strlen(msg) + 1; + color = channel->config->colors[chan->color]; + + WBUFW(buf,0) = 0x2C1; + WBUFW(buf,2) = msg_len + 12; + WBUFL(buf,4) = 0; + WBUFL(buf,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WBUFP(buf,12)),(msg),(msg_len))); + + for (user = ( DB->data2ptr((iter)->first((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) ); ( (iter)->exists(iter) ); user = ( DB->data2ptr((iter)->next((iter), +# 9032 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9032 "../../../server-code/src/map/clif.c" + )) )) { + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WBUFP(buf,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + ( (iter)->destroy(iter) ); +} +# 9050 "../../../server-code/src/map/clif.c" +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { + struct block_list* bl; + struct auth_node* node; + int cmd, account_id, char_id, login_id1, sex; + unsigned int client_tick; + + if (sd) { + (showmsg->showError(("clif_parse_WantToConnection : invalid request (character already logged in)\n"))); + return; + } + + + + cmd = RFIFOW(fd,0); + account_id = RFIFOL(fd, packet_db[cmd].pos[0]); + char_id = RFIFOL(fd, packet_db[cmd].pos[1]); + login_id1 = RFIFOL(fd, packet_db[cmd].pos[2]); + client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); + sex = RFIFOB(fd, packet_db[cmd].pos[4]); + + if( core->runflag != MAPSERVER_ST_RUNNING ) { + clif->authfail_fd(fd,1); + return; + } + + + bl = map->id2bl(account_id); + if(bl && bl->type != BL_PC) { + (showmsg->showError(("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n"), account_id)); + WFIFOHEAD(fd,packet_db[0x6a].len); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = 3; + WFIFOSET(fd,packet_db[0x6a].len); + sockt->eof(fd); + + return; + } + + if (bl || + ((node=chrif->search(account_id)) && + !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) + { + clif->authfail_fd(fd, 8); + return; + } + + ((sd) = (struct map_session_data *) (iMalloc->calloc(((1)),(sizeof(struct map_session_data)),"../../../server-code/src/map/clif.c", 9096, __func__))); + sd->fd = fd; + + sd->cryptKey = (( ((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF) + * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + sd->parse_cmd_func = clif->parse_cmd; + + sockt->session[fd]->session_data = sd; + + pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + + + + + + + WFIFOHEAD(fd,packet_db[0x283].len); + WFIFOW(fd,0) = 0x283; + WFIFOL(fd,2) = sd->bl.id; + WFIFOSET(fd,packet_db[0x283].len); + + + chrif->authreq(sd, +# 9118 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9118 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { + +# 9125 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9125 "../../../server-code/src/map/clif.c" + first_time = +# 9125 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9125 "../../../server-code/src/map/clif.c" + ; + + if(sd->bl.prev != +# 9127 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9127 "../../../server-code/src/map/clif.c" + ) + return; + + if (!sd->state.active) { + + sd->state.connect_new = 0; + return; + } + + if (sd->state.rewarp) { + sd->state.rewarp = 0; + clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y); + return; + } + + sd->state.warping = 0; + sd->state.dialog = 0; + + + + + + + clif->changelook(&sd->bl,LOOK_WEAPON,0); + + + if(sd->vd.cloth_color) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); + if (sd->vd.body_style) + clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF); + + clif->inventorylist(sd); + pc->checkitem(sd); + + + if(( (sd)->sc.data[SC_PUSH_CART] )) { + clif->cartlist(sd); + clif->updatestatus(sd,SP_CARTINFO); + } + + + clif->updatestatus(sd,SP_WEIGHT); + clif->updatestatus(sd,SP_MAXWEIGHT); + + + + if(sd->status.guild_id) + guild->send_memberinfoshort(sd,1); + + if(battle_config.pc_invincible_time > 0) { + pc->setinvincibletimer(sd,battle_config.pc_invincible_time); + } + + if( map->list[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) + map->spawnmobs(sd->bl.m); + + if( map->list[sd->bl.m].instance_id >= 0 ) { + instance->list[map->list[sd->bl.m].instance_id].users++; + instance->check_idle(map->list[sd->bl.m].instance_id); + } + + if( ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_HPMETER)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_HPMETER)) != 0 ) ) { + map->list[sd->bl.m].hpmeter_visible++; + sd->state.hpmeter_visible = 1; + } + + if (!( (sd)->sc.option&OPTION_INVISIBLE )) { + map->list[sd->bl.m].users_pvp++; + } + + sd->state.debug_remove_map = 0; + + + sd->state.callshop = 0; + + map->addblock(&sd->bl); + clif->spawn(&sd->bl); + + + + if(sd->status.party_id) { + party->send_movemap(sd); + clif->party_hp(sd); + } + + if( sd->bg_id ) clif->bg_hp(sd); + + if (map->list[sd->bl.m].flag.pvp && !( (sd)->sc.option&OPTION_INVISIBLE )) { + if(!battle_config.pk_mode) { + if (!map->list[sd->bl.m].flag.pvp_nocalcrank) + sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; + } + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + } else + + if(sd->duel_group) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if (map->list[sd->bl.m].flag.gvg_dungeon) + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + + if( (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) + clif->map_property(sd, MAPPROPERTY_AGITZONE); + + + + map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-(battle->bc->area_size), sd->bl.y-(battle->bc->area_size), sd->bl.x+(battle->bc->area_size), sd->bl.y+(battle->bc->area_size), BL_ALL, sd); + + + if( sd->pd ) { + if( battle_config.pet_no_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(866))); + pet->menu(sd, 3); + } else { + map->addblock(&sd->pd->bl); + clif->spawn(&sd->pd->bl); + clif->send_petdata(sd,sd->pd,0,0); + clif->send_petstatus(sd); + + } + } + + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) ) { + map->addblock(&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); + clif->homskillinfoblock(sd); + if( battle_config.hom_setting&0x8 ) + (status->calc_bl_((&sd->hd->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + if( !(battle_config.hom_setting&0x2) ) + skill->unit_move(&sd->hd->bl,timer->gettick(),1); + } + + if( sd->md ) { + map->addblock(&sd->md->bl); + clif->spawn(&sd->md->bl); + clif->mercenary_info(sd); + clif->mercenary_skillblock(sd); + (status->calc_bl_((&sd->md->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if( sd->ed ) { + map->addblock(&sd->ed->bl); + clif->spawn(&sd->ed->bl); + clif->elemental_info(sd); + clif->elemental_updatestatus(sd,SP_HP); + clif->hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.max_hp); + clif->elemental_updatestatus(sd,SP_SP); + (status->calc_bl_((&sd->ed->bl), (enum scb_flag)(SCB_SPEED), SCO_NONE)); + } + + if(sd->state.connect_new) { + int lv; + first_time = +# 9288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9288 "../../../server-code/src/map/clif.c" + ; + sd->state.connect_new = 0; + clif->skillinfoblock(sd); + clif->hotkeys(sd); + clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd,SP_NEXTBASEEXP); + clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd,SP_NEXTJOBEXP); + clif->updatestatus(sd,SP_SKILLPOINT); + clif->initialstatus(sd); + + if (( (sd)->sc.option&OPTION_FALCON )) + clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_DRAGON )) + clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + else if (( (sd)->sc.option&OPTION_WUGRIDER )) + clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + + if(sd->status.manner < 0) + (status->change_start(( +# 9307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9307 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + + if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) { + int i; + for (i = 0; i < 3; i++) { + if (sd->bl.m == sd->feel_map[i].m) { + (status->change_start(( +# 9314 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9314 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(SC_KNOWLEDGE),100*(100),(lv),0,0,0,(skill->get_time(SG_KNOWLEDGE, lv)),SCFLAG_NONE)); + break; + } + } + } + + 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)); + + if(((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + homun->init_timers(sd->hd); + + if (map->night_flag && map->list[sd->bl.m].flag.nightenabled) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + + + map->foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + + + npc->script_event(sd, NPCE_LOGIN); + } else { + + clif->updatestatus(sd,SP_STR); + clif->updatestatus(sd,SP_AGI); + clif->updatestatus(sd,SP_VIT); + clif->updatestatus(sd,SP_INT); + clif->updatestatus(sd,SP_DEX); + clif->updatestatus(sd,SP_LUK); + + if (sd->state.warp_clean) { + + sd->state.using_fake_npc = 0; + sd->state.menu_or_input = 0; + sd->npc_menu = 0; + if(sd->npc_id) + npc->event_dequeue(sd); + } else { + sd->state.warp_clean = 1; + } + if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) ) + clif->guild_notice(sd,sd->guild); + } + + if( sd->state.changemap ) { + + clif->partyinvitationstate(sd); + clif->equpcheckbox(sd); + + if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) + && ((map->list[sd->state.pmap].flag.gvg || map->list[sd->state.pmap].flag.gvg_castle) || (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) + || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) ) + (status->calc_bl_((&sd->bl), (enum scb_flag)(SCB_FLEE), SCO_NONE)); + + if( map->night_flag && map->list[sd->bl.m].flag.nightenabled ) { + + if( !sd->state.night ) { + sd->state.night = 1; + clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0); + } + } else if( sd->state.night ) { + sd->state.night = 0; + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_SKE); + } + + if( map->list[sd->bl.m].flag.battleground ) { + clif->map_type(sd, MAPTYPE_BATTLEFIELD); + if( map->list[sd->bl.m].flag.battleground == 2 ) + clif->bg_updatescore_single(sd); + } + + if( map->list[sd->bl.m].flag.allowks && !(map->list[sd->bl.m].flag.town || map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.battleground) ) { + char output[128]; + sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]"); + clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); + } + + map->iwall_get(sd); + (status->calc_bl_(&(sd)->bl, SCB_ALL, (SCO_NONE))); + sd->state.changemap = +# 9394 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9394 "../../../server-code/src/map/clif.c" + ; + + if (channel->config->local && channel->config->local_autojoin) { + channel->map_join(sd); + } + if (channel->config->irc && channel->config->irc_autojoin) { + channel->irc_join(sd); + } + } + + mail->clear(sd); + + clif->maptypeproperty2(&sd->bl,SELF); + + + if( sd->state.gmaster_flag ) { + guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->guild,GD_LEADERSHIP)); + guild->aura_refresh(sd,GD_GLORYWOUNDS,guild->checkskill(sd->guild,GD_GLORYWOUNDS)); + guild->aura_refresh(sd,GD_SOULCOLD,guild->checkskill(sd->guild,GD_SOULCOLD)); + guild->aura_refresh(sd,GD_HAWKEYES,guild->checkskill(sd->guild,GD_HAWKEYES)); + } + + if( sd->state.vending ) { + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); + } + + if(map->list[sd->bl.m].flag.loadevent) + npc->script_event(sd, NPCE_LOADMAP); + + if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL1); + + if (sd->sc.opt2) + clif->changeoption(&sd->bl); + + if( sd->sc.data[SC_MONSTER_TRANSFORM] && battle_config.mon_trans_disable_in_gvg && (map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle) ){ + (status->change_end_((&sd->bl),(SC_MONSTER_TRANSFORM),((-1)),"../../../server-code/src/map/clif.c",9431)); + clif->message(sd->fd, atcommand->msgsd((sd),(1488))); + } + + clif->weather_check(sd); + + + if( sd->guild && first_time ) + clif->guild_notice(sd, sd->guild); + + + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC)) + npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + + + if( !sd->status.hp && !( (sd)->state.dead_sit == 1 ) && status->isdead(&sd->bl) ) + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ); + + + if(( (sd)->state.dead_sit == 1 )) + clif->clearunit_area(&sd->bl, CLR_DEAD); + else { + skill->usave_trigger(sd); + sd->ud.dir = 0; + } + + + if(!battle_config.pc_invincible_time) + skill->unit_move(&sd->bl,timer->gettick(),1); + + + + { + int i; + for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { + struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; + if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) { + if( qi->hasJob ) { + if( sd->class_ == qi->job ) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } + } + } + +} + + + +void clif_notify_time(struct map_session_data* sd, int64 time) { + int fd; + + do { if (((void)(sd), +# 9487 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9487 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x7f].len); + WFIFOW(fd,0) = 0x7f; + WFIFOL(fd,2) = (uint32)time; + WFIFOSET(fd,packet_db[0x7f].len); +} + +void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TickSend(int fd, struct map_session_data *sd) +{ + sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + clif->notify_time(sd, timer->gettick()); +} + + + + + + +void clif_hotkeys_send(struct map_session_data *sd) { + + struct packet_hotkey p; + int i; + do { if (((void)(sd), +# 9517 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9517 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = hotkeyType; + + p.Rotate = sd->status.hotkey_rowshift; + + for(i = 0; i < ( (int)(sizeof(p.hotkey)/sizeof((p.hotkey)[0])) ); i++) { + p.hotkey[i].isSkill = sd->status.hotkeys[i].type; + p.hotkey[i].ID = sd->status.hotkeys[i].id; + p.hotkey[i].count = sd->status.hotkeys[i].lv; + } + clif->send(&p, sizeof(p), &sd->bl, SELF); + +} + +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); +} + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Hotkey(int fd, struct map_session_data *sd) { + + unsigned short idx; + int cmd; + + cmd = RFIFOW(fd, 0); + idx = RFIFOW(fd, packet_db[cmd].pos[0]); + if (idx >= 38) return; + + sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); + sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); + sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); + +} + + + + +void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +{ + int fd; + + do { if (((void)(sd), +# 9563 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9563 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f0].len); + WFIFOW(fd,0) = 0x2f0; + WFIFOL(fd,2) = color; + WFIFOL(fd,6) = second; + WFIFOSET(fd,packet_db[0x2f0].len); +} + + + +void clif_progressbar_abort(struct map_session_data * sd) +{ + int fd; + + do { if (((void)(sd), +# 9579 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9579 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2f2].len); + WFIFOW(fd,0) = 0x2f2; + WFIFOSET(fd,packet_db[0x2f2].len); +} + +void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); + + +void clif_parse_progressbar(int fd, struct map_session_data * sd) +{ + int npc_id = sd->progressbar.npc_id; + + if( timer->gettick() < sd->progressbar.timeout && sd->st ) + sd->st->state = END; + + sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0; + npc->scriptcont(sd, npc_id, +# 9598 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 9598 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +{ + short x, y; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) + ; + + + else if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) + return; + + pc->delinvincibletimer(sd); + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, +# 9627 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9627 "../../../server-code/src/map/clif.c" + ); + + + pc->update_idle_time(sd, BCIDLE_WALK); + + unit->walktoxy(&sd->bl, x, y, 4); +} + + + + + + + +void clif_disconnect_ack(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 9645 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9645 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x18b].len); + WFIFOW(fd,0) = 0x18b; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x18b].len); +} + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_QuitGame(int fd, struct map_session_data *sd) +{ + + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && + (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) ) + { + sockt->eof(fd); + + clif->disconnect_ack(sd, 0); + } else { + clif->disconnect_ack(sd, 1); + } +} + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { + int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct block_list* bl; + + + if( id < 0 && -id == sd->bl.id ) + id = sd->bl.id; + + bl = map->id2bl(id); + if( bl == +# 9687 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9687 "../../../server-code/src/map/clif.c" + ) + return; + + if( sd->bl.m != bl->m || !(path->check_distance((&sd->bl)->x - (bl)->x, (&sd->bl)->y - (bl)->y, (battle->bc->area_size))) ) + return; +# 9709 "../../../server-code/src/map/clif.c" + clif->charnameack(fd, bl); +} +int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { + struct map_session_data * sd; + if( (sd = map->id2sd(id)) ) { + sd->fontcolor_tid = (-1); + if( sd->fontcolor && sd->disguise == sd->status.class_ ) + pc->disguise(sd,-1); + } + return 0; +} + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + size_t textlen = RFIFOW(fd,2) - 4; + + const char *name = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + , *message = +# 9730 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9730 "../../../server-code/src/map/clif.c" + ; + char *fakename = +# 9731 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9731 "../../../server-code/src/map/clif.c" + ; + size_t namelen, messagelen; + + +# 9734 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 9734 "../../../server-code/src/map/clif.c" + is_fake; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 9740 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9740 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + if( (sd->class_&0x0fff) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + if( (battle_config.snovice_call_type || percent) && ( percent%100 ) == 0 ) { + switch (sd->state.snovice_call_flag) { + case 0: + if( strstr(message, atcommand->msg(1479)) ) + sd->state.snovice_call_flag = 1; + break; + case 1: { + char buf[256]; + snprintf(buf, 256, atcommand->msg(1480), sd->status.name); + if( strstr(message, buf) ) + sd->state.snovice_call_flag = 2; + } + break; + case 2: + if( strstr(message, atcommand->msg(1481)) ) + sd->state.snovice_call_flag = 3; + break; + case 3: + (status->change_start(( +# 9775 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9775 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + sd->state.snovice_call_flag = 0; + break; + } + } + } + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->gcbind ) { + channel->send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + uint32 color = 0; + + if( sd->disguise == -1 ) { + sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + pc->disguise(sd,sd->status.class_); + if( ( (sd)->state.dead_sit == 1 ) ) + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + if( unit->is_walking(&sd->bl) ) + clif->move(&sd->ud); + } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != (-1) ) { + const struct TimerData *td; + if( (td = timer->get(sd->fontcolor_tid)) ) { + timer->settick(sd->fontcolor_tid, td->tick+5000); + } + } + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + color = channel->config->colors[sd->fontcolor - 1]; + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = (((color) & 0x0000FF) << 16 | ((color) & 0x00FF00) | ((color) & 0xFF0000) >> 16); + (strlib->safestrncpy_((WFIFOP(fd,12)),(mout),(mylen))); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOL(fd,4) = -sd->bl.id; + WFIFOSET(fd, mylen + 12); + return; + } + + + + + if( ( is_fake = ( sd->fakename[0] ) ) ) { + fakename = (char*) (iMalloc->malloc((strlen(sd->fakename)+messagelen+3),"../../../server-code/src/map/clif.c", 9827, __func__)); + strcpy(fakename, sd->fakename); + strcat(fakename, " : "); + strcat(fakename, message); + textlen = strlen(fakename) + 1; + } + + WFIFOHEAD(fd, 8 + textlen); + WFIFOW(fd,0) = 0x8d; + WFIFOW(fd,2) = 8 + textlen; + WFIFOL(fd,4) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(is_fake ? fakename : text),(textlen))); + + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC); + + + if( is_fake ) { + WFIFOW(fd,0) = 0x8e; + WFIFOW(fd,2) = textlen + 4; + (strlib->safestrncpy_((WFIFOP(fd,4)),(fakename),(textlen))); + (iMalloc->free((fakename),"../../../server-code/src/map/clif.c", 9847, __func__)); + } else { + memcpy(WFIFOP(fd,0), RFIFOP(fd,0), RFIFOW(fd,2)); + WFIFOW(fd,0) = 0x8e; + } + WFIFOSET(fd, WFIFOW(fd,2)); + + + logs->chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 9855, __func__), sd->bl.x, sd->bl.y, +# 9855 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9855 "../../../server-code/src/map/clif.c" + , message); + + + map->foreachinrange(npc_chat->sub, &sd->bl, (battle->bc->area_size), BL_NPC, text, textlen, &sd->bl); +} + +void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_MapMove(int fd, struct map_session_data *sd) +{ + char command[((11 + 1) + 4)+25]; + char map_name[((11 + 1) + 4)]; + + (strlib->safestrncpy_((map_name),(RFIFOP(fd,2)),(((11 + 1) + 4)))); + sprintf(command, "%cmapmove %s %d %d", atcommand->at_symbol, map_name, RFIFOW(fd,18), RFIFOW(fd,20)); + atcommand->exec(fd, sd, command, +# 9872 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 9872 "../../../server-code/src/map/clif.c" + ); +} +# 9890 "../../../server-code/src/map/clif.c" +void clif_changed_dir(struct block_list *bl, enum send_target target) +{ + unsigned char buf[64]; + + do { if (((void)(bl), +# 9894 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9894 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x9c; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = bl->type == BL_PC ? ((const TBL_PC *)BL_UCCAST_(bl))->head_dir : 0; + WBUFB(buf,8) = unit->getdir(bl); + + clif->send(buf, packet_db[0x9c].len, bl, target); + + if (disguised(bl)) { + WBUFL(buf,2) = -bl->id; + WBUFW(buf,6) = 0; + clif->send(buf, packet_db[0x9c].len, bl, SELF); + } +} + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +{ + unsigned char headdir, dir; + + headdir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]); + ( (sd)->ud.dir = (dir) ,(sd)->head_dir = (headdir) ); + + clif->changed_dir(&sd->bl, AREA_WOS); +} + +void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_Emotion(int fd, struct map_session_data *sd) +{ + int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) { + if (emoticon == E_MUTE) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + + if (sd->emotionlasttime + 1 >= time( +# 9940 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9940 "../../../server-code/src/map/clif.c" + )) { + sd->emotionlasttime = time( +# 9941 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9941 "../../../server-code/src/map/clif.c" + ); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + return; + } + sd->emotionlasttime = time( +# 9945 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 9945 "../../../server-code/src/map/clif.c" + ); + + pc->update_idle_time(sd, BCIDLE_EMOTION); + + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) { + emoticon = rnd()%6+E_DICE1; + } + + clif->emotion(&sd->bl, emoticon); + } else + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); +} + + + +void clif_user_count(struct map_session_data* sd, int count) { + int fd; + + do { if (((void)(sd), +# 9963 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9963 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0xc2].len); + WFIFOW(fd,0) = 0xc2; + WFIFOL(fd,2) = count; + WFIFOSET(fd,packet_db[0xc2].len); +} + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { + clif->user_count(sd, map->getusers()); +} + +void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +{ + do { if (((void)(sd), +# 9982 "../../../server-code/src/map/clif.c" 3 4 +0 +# 9982 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + + + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) + return; + + if(action_type != 0x00 && action_type != 0x07) + (unit->stop_walking(&(sd)->bl, (STOPWALKING_FLAG_FIXPOS))); + (unit->stop_attack(&(sd)->bl)); + + if(target_id<0 && -target_id == sd->bl.id) + target_id = sd->bl.id; + + switch(action_type) { + case 0x00: + case 0x07: + { + struct npc_data *nd = map->id2nd(target_id); + if (nd != +# 10010 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10010 "../../../server-code/src/map/clif.c" + ) { + npc->click(sd, nd); + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || ( (sd)->vd.dead_sit == 2 ) || sd->sc.option&OPTION_HIDE ) + return; + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { + if (((tick)-(sd->ud.canact_tick)) < 0) { + clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + pc->delinvincibletimer(sd); + pc->update_idle_time(sd, BCIDLE_ATTACK); + unit->attack(&sd->bl, target_id, action_type != 0); + } + break; + case 0x02: + if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if(( (sd)->vd.dead_sit == 2 )) { + + clif->sitting(&sd->bl); + return; + } + + if (sd->ud.skilltimer != (-1) || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + sd->sc.data[SC_ANKLESNARE] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) + break; + + pc->update_idle_time(sd, BCIDLE_SIT); + + ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: + + if (sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY]) + return; + + if (!( (sd)->vd.dead_sit == 2 )) { + + clif->standing(&sd->bl); + return; + } + + pc->update_idle_time(sd, BCIDLE_SIT); + + pc->setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} + +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 10096 "../../../server-code/src/map/clif.c" +void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +{ + clif->pActionRequest_sub(sd, + RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), + timer->gettick() + ); +} + +void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Restart(int fd, struct map_session_data *sd) { + switch(RFIFOB(fd,2)) { + case 0x00: + pc->respawn(sd,CLR_OUTSIGHT); + break; + case 0x01: + + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || ((timer->gettick())-(sd->canlog_tick)) > battle_config.prevent_logout) + ) { + + chrif->charselectreq(sd, sockt->session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; + } +} + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_WisMessage(int fd, struct map_session_data* sd) +{ + struct map_session_data* dstsd; + int i; + + const char *target, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + return; + + if ( atcommand->exec(fd, sd, message, +# 10146 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10146 "../../../server-code/src/map/clif.c" + ) ) + return; + + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) { + return; + } + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + + logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex->id2name((sd->mapindex),"../../../server-code/src/map/clif.c", 10163, __func__), sd->bl.x, sd->bl.y, target, message); + + + + + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { + const char *str = target+4; + struct npc_data *nd; + if ((nd = npc->name2id(str))) { + char split_data[10][(255 + 1)]; + char *split; + char output[256]; + + str = message; + + if( str[0] == '|' && strlen(str) >= 4 ) + str += 3; + for( i = 0; i < 10; ++i ) { + split = strchr(str,'#'); + if( split == +# 10182 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10182 "../../../server-code/src/map/clif.c" + ) { + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + for( ++i; i < 10; ++i ) + split_data[i][0] = '\0'; + break; + } + *split = '\0'; + (strlib->safestrncpy_((split_data[i]),(str),(( (int)(sizeof(split_data[i])/sizeof((split_data[i])[0])) )))); + str = split+1; + } + + for( i = 0; i < 10; ++i ) { + sprintf(output, "@whispervar%d$", i); + script->set_var(sd,output,(char *) split_data[i]); + } + + sprintf(output, "%s::OnWhisperGlobal", nd->exname); + npc->event(sd,output,0); + + return; + } + } else if( target[0] == '#' ) { + const char *chname = target; + struct channel_data *chan = channel->search(chname, sd); + + if (chan) { + int k; + do { for ((k) = (0); (k) < (sd->channel_count); ++(k)) if (sd->channels[k] == chan) break; } while( +# 10209 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10209 "../../../server-code/src/map/clif.c" + ); + if (k < sd->channel_count || channel->join(chan, sd, "", +# 10210 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10210 "../../../server-code/src/map/clif.c" + ) == HCS_STATUS_OK) { + channel->send(chan,sd,message); + } else { + clif->message(fd, atcommand->msgfd((fd),(1402))); + } + return; + } else if (strcasecmp(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, atcommand->msgfd((fd),(1294))); + return; + } + } + + + dstsd = map->nick2sd(target); + + if (dstsd == +# 10225 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10225 "../../../server-code/src/map/clif.c" + || strcmp(dstsd->status.name, target) != 0) { + + + + + + intif->wis_message(sd, target, message, messagelen); + return; + } + + + if (dstsd->state.ignoreAll && ( (sd)->group->level ) <= ( (dstsd)->group->level )) { + if (( (dstsd)->sc.option&OPTION_INVISIBLE ) && ( (sd)->group->level ) < ( (dstsd)->group->level )) + clif->wis_end(fd, 1); + else + clif->wis_end(fd, 3); + return; + } + + + if( dstsd->state.autotrade ) { + char output[256]; + sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); + clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1); + return; + } + + if( ( (sd)->group->level ) <= ( (dstsd)->group->level ) ) { + + do { for ((i) = (0); (i) < (20); ++(i)) if (dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0) break; } while( +# 10254 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10254 "../../../server-code/src/map/clif.c" + ); + if(i < 20 && dstsd->ignore[i].name[0] != '\0') { + clif->wis_end(fd, 2); + return; + } + } + + + clif->wis_end(fd, 0); + + + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); +} + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Broadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "kami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 10288 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 10288 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_TakeItem(int fd, struct map_session_data *sd) +{ + int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + struct flooritem_data *fitem = map->id2fi(map_object_id); + + do { + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + break; + } + + if (fitem == +# 10307 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10307 "../../../server-code/src/map/clif.c" + || fitem->bl.m != sd->bl.m) + break; + + if( sd->sc.count && ( + sd->sc.data[SC_HIDING] || + sd->sc.data[SC_CLOAKING] || + sd->sc.data[SC_TRICKDEAD] || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_CLOAKINGEXCEED] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + ) ) + break; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + break; + + if (!pc->takeitem(sd, fitem)) + break; + + return; + } while (0); + + clif->additem(sd,0,0,6); +} + +void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_DropItem(int fd, struct map_session_data *sd) +{ + int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + for(;;) { + if (( (sd)->state.dead_sit == 1 )) + break; + + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.vending ) + break; + + if (sd->sc.count && ( + sd->sc.data[SC_AUTOCOUNTER] || + sd->sc.data[SC_BLADESTOP] || + ( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOITEM) ) + )) + break; + + if (!pc->dropitem(sd, item_index, item_amount)) + break; + + pc->update_idle_time(sd, BCIDLE_DROPITEM); + + return; + } + + + clif->dropitem(sd, item_index, 0); +} + +void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseItem(int fd, struct map_session_data *sd) +{ + int n; + + if (( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl, CLR_DEAD); + return; + } + + if ( (!sd->npc_id && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) || sd->chatID ) + return; + + + pc->update_idle_time(sd, BCIDLE_USEITEM); + n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + + if (n < 0 || n >= 100) + return; + if (!pc->useitem(sd,n)) + clif->useitemack(sd,n,0, +# 10392 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10392 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_EquipItem(int fd,struct map_session_data *sd) +{ + const struct packet_equip_item *p = RP2PTR(fd); + int index = 0; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + index = p->index - 2; + if (index >= 100) + return; + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + if(!sd->status.inventory[index].identify) { + clif->equipitemack(sd, index, 0, EIA_FAIL); + return; + } + + if(!sd->inventory_data[index]) + return; + + if(sd->inventory_data[index]->type == IT_PETARMOR){ + pet->equipitem(sd, index); + return; + } + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + + if(sd->inventory_data[index]->type == IT_AMMO) + pc->equipitem(sd, index, EQP_AMMO); + else + pc->equipitem(sd, index, p->wearLocation); +} + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +{ + int index; + + if(( (sd)->state.dead_sit == 1 )) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + + if( sd->npc_id ) { + if ( !sd->npc_item_flag ) + return; + } else if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->sc.opt1) + ; + else if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || sd->state.prerefining ) + return; + + index = RFIFOW(fd,2)-2; + + pc->update_idle_time(sd, BCIDLE_USEITEM); + + pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); +} + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +{ + struct block_list *bl; + + if( ( (sd)->state.dead_sit == 1 ) ) { + clif->clearunit_area(&sd->bl,CLR_DEAD); + return; + } + if( sd->npc_id || sd->state.workinprogress&2 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + if ( ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending ) + return; + + switch (bl->type) { + case BL_MOB: + case BL_PC: + clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); + break; + case BL_NPC: + if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != (-1) ) { + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + break; + } + if( bl->m != -1 ) + npc->click(sd, ((TBL_NPC *)BL_UCAST_(bl))); + break; + } +} + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +{ + if (sd->state.trading) + return; + npc->buysellsel(sd, RFIFOL(fd,2), RFIFOB(fd,6)); +} +# 10530 "../../../server-code/src/map/clif.c" +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10533 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10533 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xca].len); + WFIFOW(fd,0) = 0xca; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xca].len); +} + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +{ + int n = ((int)RFIFOW(fd,2)-4) / 4; + int result; + + do { if (( (n >= 0) ? +# 10549 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10549 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10549, __func__, "n >= 0", "failed assertion"), +# 10549 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10549 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) { + result = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._data_ ) = +# 10558 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10558 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10558, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); } } while( +# 10558 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10558 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 4 + 4 * i); + entry.id = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10565 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10565 "../../../server-code/src/map/clif.c" + ); + } + result = npc->buylist(sd, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10568, __func__)); ( (item_list)._data_ ) = +# 10568 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10568 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10568 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10568 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_buy_result(sd, result); +} + + + + + + +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { + int fd; + + do { if (((void)(sd), +# 10584 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10584 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xcb].len); + WFIFOW(fd,0) = 0xcb; + WFIFOB(fd,2) = result; + WFIFOSET(fd,packet_db[0xcb].len); +} + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +{ + int fail=0,n; + + n = ((int)RFIFOW(fd,2)-4) /4; + + do { if (( (n >= 0) ? +# 10601 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10601 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 10601, __func__, "n >= 0", "failed assertion"), +# 10601 "../../../server-code/src/map/clif.c" 3 4 +1 +# 10601 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + if (sd->state.trading || !sd->npc_shopid) { + fail = 1; + } else { + struct itemlist item_list = { 0 }; + int i; + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._data_ ) = +# 10610 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10610 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 10610, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); } } while( +# 10610 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10610 "../../../server-code/src/map/clif.c" + ); + + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = (int)RFIFOW(fd, 4 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 4 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 10618 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10618 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->selllist(sd, &item_list); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 10622, __func__)); ( (item_list)._data_ ) = +# 10622 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 10622 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 10622 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10622 "../../../server-code/src/map/clif.c" + ); + } + + sd->npc_shopid = 0; + + clif->npc_sell_result(sd, fail); +} + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10640 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10640 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + 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); + return; + } + if( npc->isnear(&sd->bl) ) { + + + + + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + return; + } + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->create_pc_chat(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +{ + int chatid = RFIFOL(fd,2); + const char *password = RFIFOP(fd,6); + + chat->join(sd,chatid,password); +} + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +{ + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + +# 10691 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 10691 "../../../server-code/src/map/clif.c" + pub = (RFIFOB(fd,6) != 0); + const char *password = RFIFOP(fd,7); + const char *title = RFIFOP(fd,15); + char s_password[(8 + 1)]; + char s_title[(36 + 1)]; + + if( len <= 0 ) + return; + + (strlib->safestrncpy_((s_password),(password),((8 + 1)))); + (strlib->safestrncpy_((s_title),(title),((((len+1) < ((36 + 1))) ? (len+1) : ((36 + 1)))))); + + chat->change_status(sd, s_title, s_password, limit, pub); +} + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +{ + chat->change_owner(sd, RFIFOP(fd,6)); +} + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +{ + chat->kick(sd, RFIFOP(fd,2)); +} + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +{ + chat->leave(sd, +# 10730 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 10730 "../../../server-code/src/map/clif.c" + ); +} + + + + +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { + const char* msg; + char output[256]; + do { if (((void)(src), +# 10739 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10739 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + msg = atcommand->msgsd((src),(392)); + clif->disp_message( &(src)->bl, (msg), (strlen(msg)), SELF ); + + snprintf(output, 256, atcommand->msgsd((target),(393+type)), src->status.name, 256); + clif->disp_message( &(target)->bl, (output), (strlen(output)), SELF ); +} + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd; + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(!sd->chatID && ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + + + if(t_sd && t_sd->state.noask) { + 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); + return; + } + + trade->request(sd,t_sd); +} + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_TradeAck(int fd,struct map_session_data *sd) +{ + trade->ack(sd,RFIFOB(fd,2)); +} + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +{ + short index = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + + if( index == 0 ) + trade->addzeny(sd, amount); + else + trade->additem(sd, index, (short)amount); +} + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeOk(int fd,struct map_session_data *sd) +{ + trade->ok(sd); +} + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +{ + trade->cancel(sd); +} + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +{ + trade->commit(sd); +} + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_StopAttack(int fd,struct map_session_data *sd) +{ + (unit->stop_attack(&(sd)->bl)); +} + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { + int flag = 0; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) { + clif->dropitem(sd, RFIFOW(fd,2)-2,0); + clif->cart_additem_ack(sd,flag == 1?0x0:0x1); + } +} + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +{ + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); +} + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +{ + if (( (sd)->sc.option&(OPTION_RIDING) ) || ( (sd)->sc.option&OPTION_FALCON ) || ( (sd)->sc.option&OPTION_DRAGON ) || ( (sd)->sc.option&OPTION_MADOGEAR )) { + + pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + } else { + + if (sd->sc.data[SC_PUSH_CART]) + pc->setcart(sd,0); + + + + } +} + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +{ + int type; + + if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + return; + + + if( sd->npc_id || sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + type = RFIFOW(fd,2); + + if( (type == 9 && sd->status.base_level > 131) || + (type == 8 && sd->status.base_level > 121) || + (type == 7 && sd->status.base_level > 111) || + (type == 6 && sd->status.base_level > 101) || + (type == 5 && sd->status.base_level > 90) || + (type == 4 && sd->status.base_level > 80) || + (type == 3 && sd->status.base_level > 65) || + (type == 2 && sd->status.base_level > 40) || + (type == 1)) + + + + + + + + pc->setcart(sd,type); +} + + + +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ + + int type; + + if (!sd || !pc->checkskill(sd, MC_CARTDECORATE) || RFIFOL(fd, 2) != sd->status.account_id) + return; + + type = RFIFOB(fd, 6); + + if (type <= 9 || type > (9 + 3)) + return; + + pc->setcart(sd, type); + +} + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_StatusUp(int fd,struct map_session_data *sd) { + int increase_amount; + + increase_amount = RFIFOB(fd,4); + if( increase_amount < 0 ) + { + (showmsg->showDebug(("clif_parse_StatusUp: Negative 'increase' value sent by client! (fd: %d, value: %d)\n"), fd, increase_amount)) + ; + } + pc->statusup(sd, RFIFOW(fd,2), increase_amount); +} + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SkillUp(int fd,struct map_session_data *sd) +{ + pc->skillup(sd,RFIFOW(fd,2)); +} + +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 10961 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10961 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if (hd->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL) + target_id = hd->bl.id; + if (hd->ud.skilltimer != (-1)) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; + } + else if (((tick)-(hd->ud.canact_tick)) < 0){ + clif->emotion(&hd->bl, E_DOTS); + if (hd->master) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + + } + + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 10990 "../../../server-code/src/map/clif.c" 3 4 +0 +# 10990 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !hd ) + return; + if (skill->not_ok_hom(skill_id, hd)){ + clif->emotion(&hd->bl, E_DOTS); + return; + } + if ( hd->ud.skilltimer != (-1) ) { + if ( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + + } else if ( ((tick)-(hd->ud.canact_tick)) < 0 ) { + clif->emotion(&hd->bl, E_DOTS); + if ( hd->master ) + clif->skill_fail(hd->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( hd->sc.data[SC_BASILICA] ) + return; + lv = homun->checkskill(hd, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { + int lv; + + do { if (((void)(sd), +# 11019 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11019 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->bl.id != target_id && skill->get_inf(skill_id)&INF_SELF_SKILL ) + target_id = md->bl.id; + if( md->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; + } else if( ((tick)-(md->ud.canact_tick)) < 0 ) + return; + + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); +} + +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { + int lv; + do { if (((void)(sd), +# 11040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !md ) + return; + if( skill->not_ok_mercenary(skill_id, md) ) + return; + if( md->ud.skilltimer != (-1) ) + return; + if( ((tick)-(md->ud.canact_tick)) < 0 ) { + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + + if( md->sc.data[SC_BASILICA] ) + return; + lv = mercenary->checkskill(md, skill_id); + if( skill_lv > lv ) + skill_lv = lv; + if( skill_lv ) + unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); +} + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + uint16 skill_id, skill_lv; + int tmp, target_id; + int64 tick = timer->gettick(); + + skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); + + if( skill_lv < 1 ) skill_lv = 1; + + tmp = skill->get_inf(skill_id); + if (tmp&INF_GROUND_SKILL || !tmp) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + return; + } + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOID); + + if( sd->npc_id || sd->state.workinprogress&1 ){ + + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + + return; + } + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) + ) + return; + + if( ( (sd)->vd.dead_sit == 2 ) ) + return; + + if( skill->not_ok(skill_id, sd) ) + return; + + if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + target_id = sd->bl.id; + + if( target_id < 0 && -target_id == sd->bl.id ) + target_id = sd->bl.id; + + if( sd->ud.skilltimer != (-1) ) { + if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + return; + } else if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + if( !(tmp&INF_SELF_SKILL) ) + pc->delinvincibletimer(sd); + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); + return; + } + + sd->skillitem = sd->skillitemlv = 0; + + if( skill_id >= GD_SKILLBASE ) { + if( sd->state.gmaster_flag ) + skill_lv = guild->checkskill(sd->guild, skill_id); + else + skill_lv = 0; + } else { + tmp = pc->checkskill(sd, skill_id); + if( skill_lv > tmp ) + skill_lv = tmp; + } + + pc->delinvincibletimer(sd); + + if( skill_lv ) + unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); +} + + + + +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +{ + int64 tick = timer->gettick(); + + do { if (((void)(sd), +# 11178 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11178 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) + return; + + if( skill_id >= 8001 && skill_id < 8001 + 43 ) { + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + if( skill_id >= 8201 && skill_id < 8201 + 40 ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + return; + } + + + if( sd->state.workinprogress&1 ){ + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); + return; + } + + + + pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); + + if( skill->not_ok(skill_id, sd) ) + return; + if( skillmoreinfo != -1 ) { + if( ( (sd)->vd.dead_sit == 2 ) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + return; + } + + (strlib->safestrncpy_((sd->message),(RFIFOP(fd,skillmoreinfo)),((79 + 1)))); + } + + if( sd->ud.skilltimer != (-1) ) + return; + + if( ((tick)-(sd->ud.canact_tick)) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + return; + } + } + + if( sd->sc.option&OPTION_COSTUME ) + return; + + if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + return; + + if( sd->menuskill_id ) { + if( sd->menuskill_id == SA_TAMINGMONSTER ) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + } else if( sd->menuskill_id != SA_AUTOSPELL ) + return; + } + + pc->delinvincibletimer(sd); + + if( sd->skillitem == skill_id ) { + if( skill_lv != sd->skillitemlv ) + skill_lv = sd->skillitemlv; + unit->skilluse_pos(&sd->bl, x, y, skill_id, skill_lv); + } else { + int lv; + sd->skillitem = sd->skillitemlv = 0; + if( (lv = pc->checkskill(sd, skill_id)) > 0 ) { + if( skill_lv > lv ) + skill_lv = lv; + unit->skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); + } + } +} + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + -1 + ); +} + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )) + return; + if (( (sd)->vd.dead_sit == 2 )) + return; + + clif->pUseSkillToPosSub(fd, sd, + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), + RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), + packet_db[RFIFOW(fd,0)].pos[4] + ); +} + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +{ + uint16 skill_id = RFIFOW(fd,2); + char map_name[(11 + 1)]; + + mapindex->getmapname(RFIFOP(fd,4), map_name); + sd->state.workinprogress = 0; + + if(skill_id != sd->menuskill_id) + return; + + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) && (sd->state.storage_flag == STORAGE_FLAG_CLOSED && skill_id != AL_TELEPORT)) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + pc->delinvincibletimer(sd); + skill->castend_map(sd,skill_id,map_name); +} + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +{ + if (!( (sd)->state.dead_sit == 1 )) + pc->memo(sd,-1); +} + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +{ + switch( sd->menuskill_id ) { + case -1: + case AM_PHARMACY: + case RK_RUNEMASTERY: + case GC_RESEARCHNEWPOISON: + break; + default: + return; + } + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,RFIFOW(fd,2),sd->menuskill_val, 1) ) + skill->produce_mix(sd,0,RFIFOW(fd,2),RFIFOW(fd,4),RFIFOW(fd,6),RFIFOW(fd,8), 1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +# 11363 "../../../server-code/src/map/clif.c" +void clif_parse_Cooking(int fd,struct map_session_data *sd) { + int type = RFIFOW(fd,2); + int nameid = RFIFOW(fd,4); + int amount = sd->menuskill_val2?sd->menuskill_val2:1; + if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) + return; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + if( skill->can_produce_mix(sd,nameid,sd->menuskill_val, amount) ) + skill->produce_mix(sd,(type>1?sd->menuskill_id:0),nameid,0,0,0,amount); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RepairItem(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != BS_REPAIRWEAPON) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->repairweapon(sd,RFIFOW(fd,2)); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +{ + int idx; + + sd->state.prerefining = 0; + + if (sd->menuskill_id != WS_WEAPONREFINE) + return; + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + idx = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + skill->weaponrefine(sd, idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +{ + int npc_id = RFIFOL(fd,2); + uint8 select = RFIFOB(fd,6); + + if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { + + + + struct npc_data *nd = map->id2nd(npc_id); + (showmsg->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( +# 11439 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11439 "../../../server-code/src/map/clif.c" + ,sd); + + + + return; + } + + sd->npc_menu = select; + npc->scriptcont(sd,npc_id, +# 11447 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11447 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +{ + npc->scriptcont(sd,RFIFOL(fd,2), +# 11455 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11455 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +{ + int npcid = RFIFOL(fd,2); + int amount = RFIFOL(fd,6); + + if (amount >= 0) + sd->npc_amount = amount; + else + sd->npc_amount = 0; + npc->scriptcont(sd, npcid, +# 11470 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11470 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +{ + int message_len = RFIFOW(fd,2)-8; + int npcid = RFIFOL(fd,4); + const char *message = RFIFOP(fd,8); + + if( message_len <= 0 ) + return; + + (strlib->safestrncpy_((sd->npc_str),(message),((((message_len) < ((70 + 1))) ? (message_len) : ((70 + 1)))))); + npc->scriptcont(sd, npcid, +# 11486 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 11486 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +{ + if (!sd->npc_id) + return; + sd->state.dialog = 0; + npc->scriptcont(sd, RFIFOL(fd,2), +# 11497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +{ + short idx = RFIFOW(fd,2); + + if (sd->menuskill_id != MC_IDENTIFY) + return; + if( idx == -1 ) { + sd->state.workinprogress = 0; + clif->item_identified(sd,idx-2,1); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + skill->identify(sd,idx-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= 100 || sd->inventory_data[idx] == +# 11529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11529 "../../../server-code/src/map/clif.c" + || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != (-1) && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME) == 0) + skill->identify(sd, idx); +} + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +{ + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) { + + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + switch( sd->menuskill_id ) { + case AC_MAKINGARROW: + skill->arrow_create(sd,RFIFOW(fd,2)); + break; + case SA_CREATECON: + skill->produce_mix(sd,SA_CREATECON,RFIFOW(fd,2),0,0,0, 1); + break; + case WL_READING_SB: + skill->spellbook(sd,RFIFOW(fd,2)); + break; + case GC_POISONINGWEAPON: + skill->poisoningweapon(sd,RFIFOW(fd,2)); + break; + case NC_MAGICDECOY: + skill->magicdecoy(sd,RFIFOW(fd,2)); + break; + } + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +{ + uint16 skill_id = RFIFOL(fd,2); + + sd->state.workinprogress = 0; + + if( sd->menuskill_id != SA_AUTOSPELL ) + return; + + if( !skill_id ) + return; + + skill->autospell(sd, skill_id); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_UseCard(int fd,struct map_session_data *sd) +{ + clif->use_card(sd,RFIFOW(fd,2)-2); +} + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_InsertCard(int fd,struct map_session_data *sd) +{ + pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); +} + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { + int charid; + + charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + map->reqnickdb(sd, charid); +} + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ResetChar(int fd, struct map_session_data *sd) { + char cmd[15]; + + if( RFIFOW(fd,2) ) + sprintf(cmd,"%cskreset",atcommand->at_symbol); + else + sprintf(cmd,"%cstreset",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 11631 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11631 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +{ + const char commandname[] = "lkami"; + char command[sizeof commandname + 2 + (255 + 1)] = ""; + int len = (int)RFIFOW(fd,2) - 4; + + if (len < 0) + return; + + sprintf(command, "%c%s ", atcommand->at_symbol, commandname); + + + if (len >= (int)(sizeof command - strlen(command))) + len = (int)(sizeof command - strlen(command)) - 1; + + strncat(command, RFIFOP(fd,4), len); + atcommand->exec(fd, sd, command, +# 11654 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11654 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +{ + int item_index, item_amount; + + if (( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )) + return; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + if (item_index < 0 || item_index >= 100 || item_amount < 1) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->add(sd, item_index, item_amount); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->add(sd, item_index, item_amount); +} + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +{ + int item_index, item_amount; + + item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->get(sd, item_index, item_amount); + else if(sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->get(sd, item_index, item_amount); +} + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); +} + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +{ + if( sd->state.vending ) + return; + if (!( (sd)->sc.data[SC_PUSH_CART] )) + return; + + if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) + storage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); + else if (sd->state.storage_flag == STORAGE_FLAG_GUILD) + gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); +} + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +{ + if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) + storage->close(sd); + else if( sd->state.storage_flag == STORAGE_FLAG_GUILD ) + gstorage->close(sd); +} +# 11749 "../../../server-code/src/map/clif.c" +void clif_storagepassword(struct map_session_data* sd, short info) +{ + int fd; + + do { if (((void)(sd), +# 11753 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11753 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23a].len); + WFIFOW(fd,0) = 0x23a; + WFIFOW(fd,2) = info; + WFIFOSET(fd,packet_db[0x23a].len); +} + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +{ + +} +# 11783 "../../../server-code/src/map/clif.c" +void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +{ + int fd; + + do { if (((void)(sd), +# 11787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x23c].len); + WFIFOW(fd,0) = 0x23c; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = error_count; + WFIFOSET(fd,packet_db[0x23c].len); +} + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_CreateParty(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,0,0); +} + +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +{ + char name[(23 + 1)]; + int item1 = RFIFOB(fd,26); + int item2 = RFIFOB(fd,27); + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if( map->list[sd->bl.m].flag.partylock ) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + return; + } + + party->create(sd,name,item1,item2); +} + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + + t_sd = map->nick2sd(name); + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 1); + return; + } + + party->invite(sd, t_sd); +} + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); +} + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->leave(sd); +} + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.partylock) { + + clif->message(fd, atcommand->msgfd((fd),(227))); + return; + } + party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); +} + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +{ + struct party_data *p; + int i; + + if( !sd->status.party_id ) + return; + + p = party->search(sd->status.party_id); + if( p == +# 11943 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 11943 "../../../server-code/src/map/clif.c" + ) + return; + + do { for ((i) = (0); (i) < (12); ++(i)) if (p->data[i].sd == sd) break; } while( +# 11946 "../../../server-code/src/map/clif.c" 3 4 +0 +# 11946 "../../../server-code/src/map/clif.c" +); + if( i == 12 ) + return; + + if( !p->party.member[i].leader ) + return; + + + + + + party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + +} + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 11976 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 11976 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + party->send_message(sd, text, textlen); +} + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { + party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); +} + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOB(fd,6+i*2); + + party->booking_register(sd, level, mapid, job); + + + +} + + + + + + + +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12034 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12034 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x803].len); + WFIFOW(fd,0) = 0x803; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x803].len); + + + +} + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + + short level = RFIFOW(fd,2); + short mapid = RFIFOW(fd,4); + short job = RFIFOW(fd,6); + unsigned long lastindex = RFIFOL(fd,8); + short resultcount = RFIFOW(fd,12); + + party->booking_search(sd, level, mapid, job, lastindex, resultcount); + + + +} + + + + + + +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12068 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12068 "../../../server-code/src/map/clif.c" + more_result) +{ + + int i, j; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + do { if (((void)(results), +# 12074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,size*count + 5); + WFIFOW(fd,0) = 0x805; + WFIFOW(fd,2) = size*count + 5; + WFIFOB(fd,4) = more_result; + for(i=0; iindex; + memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,(23 + 1)); + WFIFOL(fd,i*size+33) = pb_ad->expiretime; + WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; + WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; + for(j=0; j<6; j++) + WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j]; + } + WFIFOSET(fd,WFIFOW(fd,2)); + + + +} + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); + + + +} +# 12116 "../../../server-code/src/map/clif.c" +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + + int fd; + + do { if (((void)(sd), +# 12121 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12121 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x807].len); + WFIFOW(fd,0) = 0x807; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x807].len); + + + +} + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +{ + + short job[6]; + int i; + + for(i=0; i<6; i++) + job[i] = RFIFOW(fd,2+i*2); + + party->booking_update(sd, job); + + + +} + + + +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[38+6*2]; + + do { if (((void)(sd), +# 12158 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12158 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12159 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12159 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,(23 + 1)); + WBUFL(buf,30) = pb_ad->expiretime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; + for(i=0; i<6; i++) + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; + + clif->send(buf, packet_db[0x809].len, &sd->bl, ALL_CLIENT); + + + +} + + + +void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + + int i; + uint8 buf[6+6*2]; + + do { if (((void)(sd), +# 12184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if(pb_ad == +# 12185 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12185 "../../../server-code/src/map/clif.c" + ) return; + + WBUFW(buf,0) = 0x80a; + WBUFL(buf,2) = pb_ad->index; + for(i=0; i<6; i++) + WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i]; + clif->send(buf,packet_db[0x80a].len,&sd->bl,ALL_CLIENT); + + + +} + + + +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + + uint8 buf[6]; + + do { if (((void)(sd), +# 12204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x80b; + WBUFL(buf,2) = index; + + clif->send(buf, packet_db[0x80b].len, &sd->bl, ALL_CLIENT); + + + +} + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +{ + + + + + + + return; + +} + + + + + + +void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, +# 12237 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 12237 "../../../server-code/src/map/clif.c" + more_result) +{ +# 12262 "../../../server-code/src/map/clif.c" + return; + +} + + + + + + + +void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +{ +# 12284 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +{ +# 12301 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +{ + + + + + return; + +} +# 12325 "../../../server-code/src/map/clif.c" +void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +{ +# 12337 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ +# 12374 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ +# 12393 "../../../server-code/src/map/clif.c" + return; + +} + + + +void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +{ +# 12410 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + + +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ +# 12472 "../../../server-code/src/map/clif.c" + return; + +} +# 12519 "../../../server-code/src/map/clif.c" +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +{ +# 12544 "../../../server-code/src/map/clif.c" + return; + +} + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + + + + + + return; + +} + + +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ +# 12573 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ +# 12590 "../../../server-code/src/map/clif.c" + return; + +} + + +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ +# 12607 "../../../server-code/src/map/clif.c" + return; + +} +# 12623 "../../../server-code/src/map/clif.c" +void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseVending(int fd, struct map_session_data* sd) +{ + vending->close(sd); +} + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +{ + if( sd->npc_id ) { + return; + } + vending->list(sd,RFIFOL(fd,2)); +} + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 8; + int id = RFIFOL(fd,4); + const uint8 *data = RFIFOP(fd,8); + + vending->purchase(sd, id, sd->vended_id, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +{ + int len = (int)RFIFOW(fd,2) - 12; + int aid = RFIFOL(fd,4); + int uid = RFIFOL(fd,8); + const uint8 *data = RFIFOP(fd,12); + + vending->purchase(sd, aid, uid, data, len/4); + + + sd->vended_id = 0; +} + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_OpenVending(int fd, struct map_session_data* sd) { + short len = (short)RFIFOW(fd,2) - 85; + const char *message = RFIFOP(fd,4); + +# 12683 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12683 "../../../server-code/src/map/clif.c" + flag = (RFIFOB(fd,84) != 0) ? +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12683 "../../../server-code/src/map/clif.c" + : +# 12683 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12683 "../../../server-code/src/map/clif.c" + ; + const uint8 *data = RFIFOP(fd,85); + + if( !flag ) + sd->state.prevend = sd->state.workinprogress = 0; + + if(( (&sd->sc)->data[SC_NOCHAT] && (&sd->sc)->data[SC_NOCHAT]->val1&(MANNER_NOROOM) )) + return; + if( map->list[sd->bl.m].flag.novending ) { + clif->message (sd->fd, atcommand->msgsd((sd),(276))); + return; + } + if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) { + clif->message (sd->fd, atcommand->msgsd((sd),(204))); + return; + } + + if( message[0] == '\0' ) + return; + + vending->open(sd, message, data, len/8); +} + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +{ + char name[(23 + 1)]; + (strlib->safestrncpy_((name),(RFIFOP(fd,6)),((23 + 1)))); + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + guild->create(sd, name); +} + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +{ + clif->guild_masterormember(sd); +} + +void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 12742 "../../../server-code/src/map/clif.c" +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: + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: + clif->guild_skillinfo(sd); + break; + case 4: + clif->guild_expulsionlist(sd); + break; + default: + (showmsg->showError(("clif: guild request info: unknown type %u\n"), RFIFOL(fd,2))); + break; + } +} + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i = 4; i < RFIFOW(fd,2); i += 40 ){ + guild->change_position(sd->status.guild_id, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16)); + } +} + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +{ + int i; + + if(!sd->state.gmaster_flag) + return; + + for(i=4;ichange_memberposition(sd->status.guild_id, + RFIFOL(fd,i),RFIFOL(fd,i+4),RFIFOL(fd,i+8)); + } +} + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +{ + struct guild* g; + int guild_id = RFIFOL(fd,2); + + if( (g = guild->search(guild_id)) != +# 12811 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12811 "../../../server-code/src/map/clif.c" + ) + clif->guild_emblem(sd,g); +} + + + +# 12816 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12816 "../../../server-code/src/map/clif.c" + clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { + enum e_bitmapconst { + RGBTRIPLE_SIZE = 3, + RGBQUAD_SIZE = 4, + BITMAPFILEHEADER_SIZE = 14, + BITMAPINFOHEADER_SIZE = 40, + BITMAP_WIDTH = 24, + BITMAP_HEIGHT = 24, + }; + +#pragma pack(push, 1) + + struct s_bitmaptripple { + + + + unsigned int rgb:24; + } __attribute__((packed)); + +#pragma pack(pop) + + uint8 buf[1800]; + unsigned long buf_len = sizeof(buf); + int header = 0, bitmap = 0, offbits = 0, palettesize = 0; + + do { if (((void)(emblem), +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +)) return( +# 12841 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12841 "../../../server-code/src/map/clif.c" +); } while(0); + if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + || RBUFW(buf,0) != 0x4d42 + || RBUFL(buf,2) != buf_len + || RBUFL(buf,14) != BITMAPINFOHEADER_SIZE + || RBUFL(buf,18) != BITMAP_WIDTH + || RBUFL(buf,22) != BITMAP_HEIGHT + || RBUFL(buf,30) != 0 + ) { + + return +# 12851 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12851 "../../../server-code/src/map/clif.c" + ; + } + + offbits = RBUFL(buf,10); + + switch( RBUFW(buf,28) ) { + case 8: + palettesize = RBUFL(buf,46); + if( palettesize == 0 ) + palettesize = 256; + else if( palettesize > 256 ) + return +# 12862 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12862 "../../../server-code/src/map/clif.c" + ; + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE + RGBQUAD_SIZE * palettesize; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT; + break; + case 24: + header = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; + bitmap = BITMAP_WIDTH * BITMAP_HEIGHT * RGBTRIPLE_SIZE; + break; + default: + return +# 12871 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12871 "../../../server-code/src/map/clif.c" + ; + } + + + + + + + if( offbits < header || buf_len <= bitmap || offbits > buf_len - bitmap ) { + return +# 12880 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12880 "../../../server-code/src/map/clif.c" + ; + } + + if( battle_config.client_emblem_max_blank_percent < 100 ) { + int required_pixels = BITMAP_WIDTH * BITMAP_HEIGHT * (100 - battle_config.client_emblem_max_blank_percent) / 100; + int found_pixels = 0; + int i; +# 12895 "../../../server-code/src/map/clif.c" + switch( RBUFW(buf,28) ) { + case 8: + { + const uint8 *indexes = RBUFP(buf,offbits); + const uint32 *palette = RBUFP(buf,BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + if( indexes[i] >= palettesize ) + return +# 12903 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12903 "../../../server-code/src/map/clif.c" + ; + + + if( ( palette[indexes[i]]&0x00F8F8F8 ) != 0x00F800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12909 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12909 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + case 24: + { + const struct s_bitmaptripple *pixels = RBUFP(buf,offbits); + + for (i = 0; i < BITMAP_WIDTH * BITMAP_HEIGHT; i++) { + + if( ( pixels[i].rgb&0xF8F8F8 ) != 0xF800F8 ) { + if( ++found_pixels >= required_pixels ) { + + return +# 12924 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12924 "../../../server-code/src/map/clif.c" + ; + } + } + } + break; + } + } + + + return +# 12933 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12933 "../../../server-code/src/map/clif.c" + ; + } + + return +# 12936 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 12936 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +{ + unsigned int emblem_len = RFIFOW(fd,2)-4; + const uint8* emblem = RFIFOP(fd,4); + + if( !emblem_len || !sd->state.gmaster_flag ) + return; + + if (!clif->validate_emblem(emblem, emblem_len)) { + (showmsg->showWarning(("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%u, 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; + } + + guild->change_emblem(sd, emblem_len, (const char*)emblem); +} + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +{ + int guild_id = RFIFOL(fd,2); + char *msg1 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + , *msg2 = +# 12965 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12965 "../../../server-code/src/map/clif.c" + ; + + if (!sd->state.gmaster_flag) + return; + + msg1 = (iMalloc->astrndup((RFIFOP(fd,6)),(60 -1),"../../../server-code/src/map/clif.c", 12970, __func__)); + msg2 = (iMalloc->astrndup((RFIFOP(fd,66)),(120 -1),"../../../server-code/src/map/clif.c", 12971, __func__)); + + + if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; + if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; + if (msg2[0] == '|') msg2[(strlib->strnlen_((msg2),(120)))-1] = '\0'; + + guild->change_notice(sd, guild_id, msg1, msg2); + (iMalloc->free((msg1),"../../../server-code/src/map/clif.c", 12979, __func__)); + (iMalloc->free((msg2),"../../../server-code/src/map/clif.c", 12980, __func__)); +} + + + +# 12984 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 12984 "../../../server-code/src/map/clif.c" + clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if ( t_sd == +# 12985 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 12985 "../../../server-code/src/map/clif.c" + ) + return +# 12986 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12986 "../../../server-code/src/map/clif.c" + ; + + do { if (((void)(sd), +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +)) return( +# 12988 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12988 "../../../server-code/src/map/clif.c" +); } while(0); + do { if (((void)(t_sd), +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +)) return( +# 12989 "../../../server-code/src/map/clif.c" 3 4 +0 +# 12989 "../../../server-code/src/map/clif.c" +); } while(0); + if ( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return +# 12993 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12993 "../../../server-code/src/map/clif.c" + ; + } + + if (t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 2); + return +# 12998 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 12998 "../../../server-code/src/map/clif.c" + ; + } + + guild->invite(sd,t_sd); + return +# 13002 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13002 "../../../server-code/src/map/clif.c" + ; +} + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { + struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); + + if (!clif_sub_guild_invite(fd, sd, t_sd)) + return; +} + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + char nick[(23 + 1)]; + struct map_session_data *t_sd = +# 13021 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13021 "../../../server-code/src/map/clif.c" + ; + + (strlib->safestrncpy_((nick),(RFIFOP(fd, 2)),((23 + 1)))); + t_sd = map->nick2sd(nick); + + clif_sub_guild_invite(fd, sd, t_sd); +} + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +{ + guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + if( sd->bg_id ) { + clif->message(fd, atcommand->msgfd((fd),(870))); + return; + } + + guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->expulsion(sd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); +} + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildMessage(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 13084 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13084 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if (battle_config.min_chat_delay) { + if (((sd->cantalk_tick)-(timer->gettick())) > 0) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + if( sd->bg_id ) + bg->send_message(sd, text, textlen); + else + guild->send_message(sd, text, textlen); +} + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 3); + return; + } + + guild->reqalliance(sd,t_sd); +} + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +{ + guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); +} + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { + struct map_session_data *t_sd; + + if(!sd->state.gmaster_flag) + return; + + if(map->list[sd->bl.m].flag.guildlock) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + + t_sd = map->id2sd(RFIFOL(fd,2)); + + + if(t_sd && t_sd->state.noask) { + clif->noask_sub(sd, t_sd, 4); + return; + } + + guild->opposition(sd,t_sd); +} + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { + if( map->list[sd->bl.m].flag.guildlock ) { + + clif->message(fd, atcommand->msgfd((fd),(228))); + return; + } + guild->dobreak(sd, RFIFOP(fd,2)); +} + + + + +void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13212 "../../../server-code/src/map/clif.c" +void clif_parse_PetMenu(int fd, struct map_session_data *sd) +{ + pet->menu(sd,RFIFOB(fd,2)); +} + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_CatchPet(int fd, struct map_session_data *sd) +{ + pet->catch_process2(sd,RFIFOL(fd,2)); +} + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +{ + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { + return; + } + pet->select_egg(sd,RFIFOW(fd,2)-2); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13262 "../../../server-code/src/map/clif.c" +void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +{ + if(sd->pd) + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); +} + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +{ + pet->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMKick(int fd, struct map_session_data *sd) { + struct block_list *target; + int tid; + + tid = RFIFOL(fd,2); + target = map->id2bl(tid); + if (!target) { + clif->GM_kickack(sd, 0); + return; + } + + switch (target->type) { + case BL_PC: + { + char command[(23 + 1)+6]; + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); + atcommand->exec(fd, sd, command, +# 13297 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13297 "../../../server-code/src/map/clif.c" + ); + } + break; + + + + + case BL_MOB: + { + char command[100]; + if( !pc->can_use_command(sd, "@killmonster")) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); + logs->atcommand(sd, command); + (status->percent_change((&sd->bl), (target), (100), (0), ( +# 13313 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13313 "../../../server-code/src/map/clif.c" + )?1:2)); + } + break; + + case BL_NPC: + { + struct npc_data *nd = ((TBL_NPC *)BL_UCAST_(target)); + if( !pc->can_use_command(sd, "@unloadnpc")) { + clif->GM_kickack(sd, 0); + return; + } + npc->unload_duplicates(nd); + npc->unload(nd, +# 13325 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13325 "../../../server-code/src/map/clif.c" + ); + npc->read_event_script(); + } + break; + + default: + clif->GM_kickack(sd, 0); + } +} + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { + char cmd[15]; + sprintf(cmd,"%ckickall",atcommand->at_symbol); + atcommand->exec(fd, sd, cmd, +# 13342 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13342 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMShift(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cjumpto %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13362 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13362 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13374 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13374 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13377 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13377 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_GMRecall(int fd, struct map_session_data *sd) +{ + + char player_name[(23 + 1)]; + char command[(23 + 1)+8]; + + (strlib->safestrncpy_((player_name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%crecall %s", atcommand->at_symbol, player_name); + atcommand->exec(fd, sd, command, +# 13398 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13398 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { + int account_id; + struct map_session_data* pl_sd; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + if( (pl_sd = map->id2sd(account_id)) != +# 13410 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13410 "../../../server-code/src/map/clif.c" + ) { + char command[(23 + 1)+8]; + sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); + atcommand->exec(fd, sd, command, +# 13413 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13413 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13431 "../../../server-code/src/map/clif.c" +void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +{ + const struct packet_gm_monster_item *p = RP2PTR(fd); + int i, count; + char item_monster_name[sizeof p->str]; + struct item_data *item_array[10]; + struct mob_db *mob_array[10]; + char command[256]; + + (strlib->safestrncpy_((item_monster_name),(p->str),(sizeof(item_monster_name)))); + + if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) { + for(i = 0; i < count; i++) { + if( !item_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 ) + break; + } + + if( i < count ) { + if( item_array[i]->type == IT_WEAPON || item_array[i]->type == IT_ARMOR ) + snprintf(command, sizeof(command)-1, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand->at_symbol, item_array[i]->nameid); + else + snprintf(command, sizeof(command)-1, "%citem %d 20", atcommand->at_symbol, item_array[i]->nameid); + atcommand->exec(fd, sd, command, +# 13458 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13458 "../../../server-code/src/map/clif.c" + ); + return; + } + } + + if( strcmp("money", item_monster_name) == 0 ){ + snprintf(command, sizeof(command)-1, "%czeny %d", atcommand->at_symbol, 0x7fffffff); + atcommand->exec(fd, sd, command, +# 13465 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13465 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0) { + for(i = 0; i < count; i++) { + if( !mob_array[i] ) + continue; + + if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 ) + break; + } + + if( i < count ){ + snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand->at_symbol, mob_array[i]->sprite); + atcommand->exec(fd, sd, command, +# 13482 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13482 "../../../server-code/src/map/clif.c" + ); + } + } +} + +void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_GMHide(int fd, struct map_session_data *sd) { + char cmd[6]; + + sprintf(cmd,"%chide",atcommand->at_symbol); + + atcommand->exec(fd, sd, cmd, +# 13497 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13497 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { + int id, type, value; + struct map_session_data *dstsd; + char command[(23 + 1)+15]; + + id = RFIFOL(fd,2); + type = RFIFOB(fd,6); + value = RFIFOW(fd,7); + + if( type == 0 ) + value = -value; + + if (type == 2) { + if (!battle_config.client_accept_chatdori) + return; + if (( (sd)->group->level ) > 0 || sd->bl.id != id) + return; + + value = battle_config.client_accept_chatdori; + dstsd = sd; + } else { + dstsd = map->id2sd(id); + if( dstsd == +# 13529 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13529 "../../../server-code/src/map/clif.c" + ) + return; + } + + if (type == 2 || ( (( (sd)->group->level )) > ( (dstsd)->group->level ) && !pc->can_use_command(sd, "@mute"))) { + clif->manner_message(sd, 0); + clif->manner_message(dstsd, 5); + + if (dstsd->status.manner < value) { + dstsd->status.manner -= value; + (status->change_start(( +# 13539 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13539 "../../../server-code/src/map/clif.c" + ),(&dstsd->bl),(SC_NOCHAT),100*(100),(0),0,0,0,(0),SCFLAG_NONE)); + + } else { + dstsd->status.manner = 0; + (status->change_end_((&dstsd->bl),(SC_NOCHAT),((-1)),"../../../server-code/src/map/clif.c",13543)); + } + + if( type != 2 ) + clif->GM_silence(sd, dstsd, type); + } + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, value, dstsd->status.name); + atcommand->exec(fd, sd, command, +# 13551 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13551 "../../../server-code/src/map/clif.c" + ); +} + +void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMRc(int fd, struct map_session_data* sd) +{ + char command[(23 + 1)+15]; + char name[(23 + 1)]; + + (strlib->safestrncpy_((name),(RFIFOP(fd,2)),((23 + 1)))); + + sprintf(command, "%cmute %d %s", atcommand->at_symbol, 60, name); + atcommand->exec(fd, sd, command, +# 13566 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 13566 "../../../server-code/src/map/clif.c" + ); +} + + + +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { + int fd; + + do { if (((void)(sd), +# 13574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x1e0].len); + WFIFOW(fd,0) = 0x1e0; + WFIFOL(fd,2) = account_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(accname),((23 + 1)))); + WFIFOSET(fd,packet_db[0x1e0].len); +} + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +{ + int account_id = RFIFOL(fd,2); + + + clif->account_name(sd, account_id, ""); +} + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { + int x,y,type; + + if (!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHANGEMAPTYPE)) != 0 )) + return; + + x = RFIFOW(fd,2); + y = RFIFOW(fd,4); + type = RFIFOW(fd,6); + + map->setgatcell(sd->bl.m,x,y,type); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + +} + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +{ + char nick[(23 + 1)]; + uint8 type; + int i; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + type = RFIFOB(fd,26); + + if( type == 0 ) { + if (strcmp(map->wisp_server_name, nick) == 0) { + clif->wisexin(sd, type, 1); + return; + } + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13640 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13640 "../../../server-code/src/map/clif.c" + ); + if( i == 20 ) { + clif->wisexin(sd, type, 2); + return; + } + if( sd->ignore[i].name[0] != '\0' ) { + clif->wisexin(sd, type, 0); + return; + } + + + (strlib->safestrncpy_((sd->ignore[i].name),(nick),((23 + 1)))); + } else { + + + do { for ((i) = (0); (i) < (20); ++(i)) if (sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0) break; } while( +# 13655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 13655 "../../../server-code/src/map/clif.c" + ); + if( i == 20 || sd->ignore[i].name[i] == '\0' ) { + clif->wisexin(sd, type, 1); + return; + } + + if( i != 20 - 1 ) + memmove(&sd->ignore[i], &sd->ignore[i+1], (20 -i-1)*sizeof(sd->ignore[0])); + + memset(sd->ignore[20 -1].name, 0, sizeof(sd->ignore[0].name)); + } + + clif->wisexin(sd, type, 0); +} + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +{ + int type = RFIFOB(fd,2), flag; + + if( type == 0 ) { + if( sd->state.ignoreAll ) { + flag = 1; + } else { + sd->state.ignoreAll = 1; + flag = 0; + } + } else { + if( sd->state.ignoreAll ) { + sd->state.ignoreAll = 0; + flag = 0; + } else { + if (sd->ignore[0].name[0] != '\0') + { + memset(sd->ignore, 0, sizeof(sd->ignore)); + flag = 0; + } else { + flag = 1; + } + } + } + + clif->wisall(sd, type, flag); +} + + + +void clif_PMIgnoreList(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 13711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,4+( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) )*(23 + 1)); + WFIFOW(fd,0) = 0xd4; + + for( i = 0; i < ( (int)(sizeof(sd->ignore)/sizeof((sd->ignore)[0])) ) && sd->ignore[i].name[0]; i++ ) { + memcpy(WFIFOP(fd,4+i*(23 + 1)), sd->ignore[i].name, (23 + 1)); + } + + WFIFOW(fd,2) = 4+i*(23 + 1); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +{ + clif->PMIgnoreList(sd); +} + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +{ + if (sd->state.doridori) return; + + switch (sd->class_&0x0fff) { + case MAPID_SOUL_LINKER: + case MAPID_STAR_GLADIATOR: + case MAPID_TAEKWON: + if (!sd->state.rest) + break; + case MAPID_SUPER_NOVICE: + sd->state.doridori=1; + break; + } +} + +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 13760 "../../../server-code/src/map/clif.c" +void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +{ + + + + + if( ( sd->class_&0x0fff ) == MAPID_SUPER_NOVICE ) { + unsigned int next = pc->nextbaseexp(sd); + if( next == 0 ) next = pc->thisbaseexp(sd); + if( next ) { + int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); + + if( percent && ( percent%100 ) == 0 ) { + (status->change_start(( +# 13773 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13773 "../../../server-code/src/map/clif.c" + ),(&sd->bl),(status->skill2sc(MO_EXPLOSIONSPIRITS)),100*(100),(17),0,0,0,(skill->get_time(MO_EXPLOSIONSPIRITS, 5)),SCFLAG_NONE)); + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); + } + } + } +} +# 13788 "../../../server-code/src/map/clif.c" +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { + int i, fd; + + do { if (((void)(sd), +# 13791 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13791 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + for (i = 0; i < 40 && sd->status.friends[i].char_id && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if(i == 40 || sd->status.friends[i].char_id == 0) + return; + + WFIFOHEAD(fd,packet_db[0x206].len); + WFIFOW(fd,0) = 0x206; + WFIFOL(fd, 2) = sd->status.friends[i].account_id; + WFIFOL(fd, 6) = sd->status.friends[i].char_id; + WFIFOB(fd,10) = !online; + WFIFOSET(fd, packet_db[0x206].len); +} + + +int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +{ + int account_id, char_id, online; + account_id = +# 13812 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13812 "../../../server-code/src/map/clif.c" + ap +# 13812 "../../../server-code/src/map/clif.c" 3 4 + , +# 13812 "../../../server-code/src/map/clif.c" + int +# 13812 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13812 "../../../server-code/src/map/clif.c" + ; + char_id = +# 13813 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13813 "../../../server-code/src/map/clif.c" + ap +# 13813 "../../../server-code/src/map/clif.c" 3 4 + , +# 13813 "../../../server-code/src/map/clif.c" + int +# 13813 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13813 "../../../server-code/src/map/clif.c" + ; + online = +# 13814 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 13814 "../../../server-code/src/map/clif.c" + ap +# 13814 "../../../server-code/src/map/clif.c" 3 4 + , +# 13814 "../../../server-code/src/map/clif.c" + int +# 13814 "../../../server-code/src/map/clif.c" 3 4 + ) +# 13814 "../../../server-code/src/map/clif.c" + ; + clif->friendslist_toggle(sd, account_id, char_id, online); + return 0; +} + + + +void clif_friendslist_send(struct map_session_data *sd) +{ + int i = 0, n, fd = sd->fd; + + do { if (((void)(sd), +# 13825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd, 40 * 32 + 4); + WFIFOW(fd,0) = 0x201; + for(i = 0; i < 40 && 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, (23 + 1)); + } + + if (i) { + WFIFOW(fd,2) = 4 + 32 * i; + WFIFOSET(fd, WFIFOW(fd,2)); + } + + for (n = 0; n < i; n++) { + 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); + } +} +# 13853 "../../../server-code/src/map/clif.c" +void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +{ + int fd; + do { if (((void)(sd), +# 13856 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13856 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x209].len); + WFIFOW(fd,0) = 0x209; + WFIFOW(fd,2) = type; + 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,(23 + 1)); + } + WFIFOSET(fd, packet_db[0x209].len); +} + + + +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { + int fd; + + do { if (((void)(sd), +# 13875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13875 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x207].len); + WFIFOW(fd,0) = 0x207; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + memcpy(WFIFOP(fd,10), name, (23 + 1)); + WFIFOSET(fd,packet_db[0x207].len); +} + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int i; + char nick[(23 + 1)]; + + (strlib->safestrncpy_((nick),(RFIFOP(fd,2)),((23 + 1)))); + + f_sd = map->nick2sd(nick); + + + do { for ((i) = (0); (i) < (40); ++(i)) if (sd->status.friends[i].char_id == 0) break; } while( +# 13899 "../../../server-code/src/map/clif.c" 3 4 +0 +# 13899 "../../../server-code/src/map/clif.c" +); + + if( i == 40 ) { + clif->friendslist_reqack(sd, f_sd, 2); + return; + } + + + if (f_sd == +# 13907 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13907 "../../../server-code/src/map/clif.c" + ) { + clif->message(fd, atcommand->msgfd((fd),(3))); + return; + } + + if( sd->bl.id == f_sd->bl.id ) { + return; + } + + + if(f_sd->state.noask) { + clif->noask_sub(sd, f_sd, 5); + return; + } + + + for (i = 0; i < 40 && sd->status.friends[i].char_id != 0; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) { + clif->message(fd, atcommand->msgfd((fd),(871))); + return; + } + } + + 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); +} + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd; + int account_id; + char reply; + + account_id = RFIFOL(fd,2); + + + + + reply = RFIFOL(fd,10); + + + if( sd->bl.id == account_id ) { + return; + } + + f_sd = map->id2sd(account_id); + if (f_sd == +# 13962 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 13962 "../../../server-code/src/map/clif.c" + ) + 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); + else { + int i; + + for (i = 0; i < 40; i++) + if (f_sd->status.friends[i].char_id == 0) + break; + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(f_sd, sd, 0); + + if (battle_config.friend_auto_add) { + + for (i = 0; i < 40; i++) { + if (sd->status.friends[i].char_id == f_sd->status.char_id) + return; + if (sd->status.friends[i].char_id == 0) + break; + } + if (i == 40) { + 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, (23 + 1)); + clif->friendslist_reqack(sd, f_sd, 0); + } + } +} + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +{ + struct map_session_data *f_sd = +# 14009 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14009 "../../../server-code/src/map/clif.c" + ; + int account_id, char_id; + int i, j; + + account_id = RFIFOL(fd,2); + char_id = RFIFOL(fd,6); + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + if (i == 40) { + clif->message(fd, atcommand->msgfd((fd),(872))); + return; + } + + + if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) { + for (i = 0; i < 40 && + (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); + + if (i != 40) { + + for(j = i + 1; j < 40; j++) + memcpy(&f_sd->status.friends[j-1], &f_sd->status.friends[j], sizeof(f_sd->status.friends[0])); + + memset(&f_sd->status.friends[40 -1], 0, sizeof(f_sd->status.friends[40 -1])); + + WFIFOHEAD(f_sd->fd,packet_db[0x20a].len); + WFIFOW(f_sd->fd,0) = 0x20a; + WFIFOL(f_sd->fd,2) = sd->status.account_id; + WFIFOL(f_sd->fd,6) = sd->status.char_id; + WFIFOSET(f_sd->fd, packet_db[0x20a].len); + } + + } else { + if(!chrif->removefriend(char_id,sd->status.char_id)) { + clif->message(fd, atcommand->msgfd((fd),(873))); + return; + } + } + + + for (i = 0; i < 40 && + (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); + + for(j = i + 1; j < 40; j++) + memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); + + memset(&sd->status.friends[40 -1], 0, sizeof(sd->status.friends[40 -1])); + clif->message(fd, atcommand->msgfd((fd),(874))); + + WFIFOHEAD(fd,packet_db[0x20a].len); + WFIFOW(fd,0) = 0x20a; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOSET(fd, packet_db[0x20a].len); +} + + + +void clif_PVPInfo(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14073 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14073 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x210].len); + WFIFOW(fd,0) = 0x210; + WFIFOL(fd,2) = sd->status.char_id; + WFIFOL(fd,6) = sd->status.account_id; + WFIFOL(fd,10) = sd->pvp_won; + WFIFOL(fd,14) = sd->pvp_lost; + WFIFOL(fd,18) = sd->pvp_point; + WFIFOSET(fd, packet_db[0x210].len); +} + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +{ + + clif->PVPInfo(sd); +} + + + + +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { + const char* name; + struct fame_list* list; + int i; + + do { if (((void)(buf), +# 14102 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14102 "../../../server-code/src/map/clif.c" +)) return; } while(0); + switch( type ) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; + } + + + for( i = 0; i < 10 && i < 10; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != +# 14113 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14113 "../../../server-code/src/map/clif.c" + ) { + strncpy(WBUFP(buf, 24 * i), name, (23 + 1)); + } else { + strncpy(WBUFP(buf, 24 * i), list[i].name, (23 + 1)); + } + } else { + strncpy(WBUFP(buf, 24 * i), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; + } + for( ;i < 10; i++ ) { + strncpy(WBUFP(buf, 24 * i), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; + } +} + + +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd; + int mypoint = 0; + int upperMask; + + do { if (((void)(sd), +# 14135 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14135 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + upperMask = sd->class_&0x0fff; + WFIFOHEAD(fd, 288); + WFIFOW(fd,0) = 0x97d; + WFIFOW(fd,2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; + WFIFOSET(fd, 288); +} + +void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); + break; + } +} + + +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +# 14182 "../../../server-code/src/map/clif.c" + int fd; + + do { if (((void)(sd), +# 14184 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14184 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd,0) = 0x97e; + WFIFOW(fd,2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); + +} + + + +void clif_blacksmith(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14200 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14200 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x219].len); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_db[0x219].len); +} + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { + clif->blacksmith(sd); +} + + + +void clif_fame_blacksmith(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14220 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14220 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21b].len); + WFIFOW(fd,0) = 0x21b; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21b].len); +} + + + +void clif_alchemist(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14234 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14234 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21a].len); + WFIFOW(fd,0) = 0x21a; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); + WFIFOSET(fd, packet_db[0x21a].len); +} + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { + clif->alchemist(sd); +} + + + +void clif_fame_alchemist(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14254 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14254 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x21c].len); + WFIFOW(fd,0) = 0x21c; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x21c].len); +} + + + +void clif_taekwon(struct map_session_data* sd) { + int fd; + + do { if (((void)(sd), +# 14268 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14268 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x226].len); + WFIFOW(fd,0) = 0x226; + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); + WFIFOSET(fd, packet_db[0x226].len); +} + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { + clif->taekwon(sd); +} + + + +void clif_fame_taekwon(struct map_session_data *sd, int points) { + int fd; + + do { if (((void)(sd), +# 14288 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14288 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x224].len); + WFIFOW(fd,0) = 0x224; + WFIFOL(fd,2) = points; + WFIFOL(fd,6) = sd->status.fame; + WFIFOSET(fd, packet_db[0x224].len); +} + + + +void clif_ranking_pk(struct map_session_data* sd) { + int i, fd; + + do { if (((void)(sd), +# 14302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14302 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x238].len); + WFIFOW(fd,0) = 0x238; + for (i = 0; i < 10;i ++) { + strncpy(WFIFOP(fd, i * 24 + 2), "Unknown", (23 + 1)); + WFIFOL(fd,i*4+242) = 0; + } + WFIFOSET(fd, packet_db[0x238].len); +} + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { + clif->ranking_pk(sd); +} + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +{ + int i; + if (sd->menuskill_id != SG_FEEL) + return; + i = sd->menuskill_val-1; + if (i<0 || i >= 3) return; + + sd->feel_map[i].index = (map->list[(sd->bl.m)].index); + sd->feel_map[i].m = sd->bl.m; + (pc->setregistry((sd),(script->add_str(pc->sg_info[i].feel_var)),(sd->feel_map[i].index))); + + + + + + clif->feel_info(sd, i, 0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + + + + +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +{ + do { if (((void)(sd), +# 14355 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14355 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x253].len); + WFIFOW(fd,0)=0x253; + WFIFOB(fd,2)=TOB(skill_lv-1); + WFIFOSET(fd, packet_db[0x253].len); + sd->menuskill_id = SG_FEEL; + sd->menuskill_val = skill_lv; +} + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +{ + homun->change_name(sd, RFIFOP(fd,2)); +} + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14378 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14378 "../../../server-code/src/map/clif.c" + ; + struct unit_data *ud = +# 14379 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14379 "../../../server-code/src/map/clif.c" + ; + + if (sd->md && sd->md->bl.id == id) + bl = &sd->md->bl; + else if (((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id) + bl = &sd->hd->bl; + else + return; + + unit->calc_pos(bl, sd->bl.x, sd->bl.y, sd->ud.dir); + ud = unit->bl2ud(bl); + unit->walktoxy(bl, ud->to_x, ud->to_y, 4); +} + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +{ + int id = RFIFOL(fd,2); + struct block_list *bl = +# 14399 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14399 "../../../server-code/src/map/clif.c" + ; + short x, y; + + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[1], &x, &y, +# 14402 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14402 "../../../server-code/src/map/clif.c" + ); + + if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else + return; + + unit->walktoxy(bl, x, y, 4); +} + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_HomAttack(int fd,struct map_session_data *sd) +{ + struct block_list *bl = +# 14421 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14421 "../../../server-code/src/map/clif.c" + ; + int id = RFIFOL(fd,2), + target_id = RFIFOL(fd,6), + action_type = RFIFOB(fd,10); + + if( ((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0) && sd->hd->bl.id == id ) + bl = &sd->hd->bl; + else if( sd->md && sd->md->bl.id == id ) + bl = &sd->md->bl; + else return; + + unit->stop_attack(bl); + unit->attack(bl, target_id, action_type != 0); +} + +void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +# 14445 "../../../server-code/src/map/clif.c" +void clif_parse_HomMenu(int fd, struct map_session_data *sd) { + int cmd; + + cmd = RFIFOW(fd,0); + + if(!((sd->hd) && (sd->hd)->homunculus.vaporize == HOM_ST_ACTIVE && (sd->hd)->battle_status.hp > 0)) + return; + + homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); +} + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { + int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; + + if (item_position == (-1)) { + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } + + if (sd->sc.data[SC_HELLPOWER]) + return; + + if (!status->revive(&sd->bl, hpsp, hpsp)) + return; + + if (item_position == (-1)) + (status->change_end_((&sd->bl),(SC_LIGHT_OF_REGENE),((-1)),"../../../server-code/src/map/clif.c",14477)); + else + pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME); + + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); +} +# 14491 "../../../server-code/src/map/clif.c" +void clif_check(int fd, struct map_session_data* pl_sd) { + do { if (((void)(pl_sd), +# 14492 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14492 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x214].len); + WFIFOW(fd,0) = 0x214; + WFIFOB(fd, 2) = (((pl_sd->status.str) < (((uint8) 0xFF))) ? (pl_sd->status.str) : (((uint8) 0xFF))); + WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 4) = (((pl_sd->status.agi) < (((uint8) 0xFF))) ? (pl_sd->status.agi) : (((uint8) 0xFF))); + WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 6) = (((pl_sd->status.vit) < (((uint8) 0xFF))) ? (pl_sd->status.vit) : (((uint8) 0xFF))); + WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 8) = (((pl_sd->status.int_) < (((uint8) 0xFF))) ? (pl_sd->status.int_) : (((uint8) 0xFF))); + WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd,10) = (((pl_sd->status.dex) < (((uint8) 0xFF))) ? (pl_sd->status.dex) : (((uint8) 0xFF))); + WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,12) = (((pl_sd->status.luk) < (((uint8) 0xFF))) ? (pl_sd->status.luk) : (((uint8) 0xFF))); + WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1); + WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; + WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; + WFIFOW(fd,18) = pl_sd->battle_status.matk_max; + WFIFOW(fd,20) = pl_sd->battle_status.matk_min; + WFIFOW(fd,22) = pl_sd->battle_status.def; + WFIFOW(fd,24) = pl_sd->battle_status.def2; + WFIFOW(fd,26) = pl_sd->battle_status.mdef; + WFIFOW(fd,28) = pl_sd->battle_status.mdef2; + WFIFOW(fd,30) = pl_sd->battle_status.hit; + WFIFOW(fd,32) = pl_sd->battle_status.flee; + WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; + WFIFOW(fd,36) = pl_sd->battle_status.cri/10; + WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; + WFIFOW(fd,40) = 0; + WFIFOSET(fd,packet_db[0x214].len); +} + +void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_Check(int fd, struct map_session_data *sd) +{ + char charname[(23 + 1)]; + struct map_session_data* pl_sd; + + if(!( ((sd)->extra_temp_permissions&(PC_PERM_USE_CHECK)) != 0 || ((sd)->group->e_permissions&(PC_PERM_USE_CHECK)) != 0 )) + return; + + (strlib->safestrncpy_((charname),(RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0])),(sizeof(charname)))); + + if( ( pl_sd = map->nick2sd(charname) ) == +# 14538 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14538 "../../../server-code/src/map/clif.c" + || ( (sd)->group->level ) < ( (pl_sd)->group->level ) ) { + return; + } + + clif->check(fd, pl_sd); +} +# 14554 "../../../server-code/src/map/clif.c" +void clif_Mail_setattachment(int fd, int index, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x255].len); + WFIFOW(fd,0) = 0x255; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = flag; + WFIFOSET(fd,packet_db[0x255].len); +} + + + + + + + +void clif_Mail_getattachment(int fd, uint8 flag) +{ + WFIFOHEAD(fd,packet_db[0x245].len); + WFIFOW(fd,0) = 0x245; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x245].len); +} + + + + + + +void clif_Mail_send(int fd, +# 14582 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 14582 "../../../server-code/src/map/clif.c" + fail) +{ + WFIFOHEAD(fd,packet_db[0x249].len); + WFIFOW(fd,0) = 0x249; + WFIFOB(fd,2) = fail; + WFIFOSET(fd,packet_db[0x249].len); +} + + + + + + +void clif_Mail_delete(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd, packet_db[0x257].len); + WFIFOW(fd,0) = 0x257; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd, packet_db[0x257].len); +} + + + + + + +void clif_Mail_return(int fd, int mail_id, short fail) +{ + WFIFOHEAD(fd,packet_db[0x274].len); + WFIFOW(fd,0) = 0x274; + WFIFOL(fd,2) = mail_id; + WFIFOW(fd,6) = fail; + WFIFOSET(fd,packet_db[0x274].len); +} + + + +void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +{ + do { if (((void)(sender), +# 14622 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14622 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(title), +# 14623 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14623 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,packet_db[0x24a].len); + WFIFOW(fd,0) = 0x24a; + WFIFOL(fd,2) = mail_id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(title),(40))); + (strlib->safestrncpy_((WFIFOP(fd,46)),(sender),((23 + 1)))); + WFIFOSET(fd,packet_db[0x24a].len); +} + + + + + + +void clif_Mail_window(int fd, int flag) +{ + WFIFOHEAD(fd,packet_db[0x260].len); + WFIFOW(fd,0) = 0x260; + WFIFOL(fd,2) = flag; + WFIFOSET(fd,packet_db[0x260].len); +} + + + + + + +void clif_Mail_refreshinbox(struct map_session_data *sd) +{ + int fd = sd->fd; + struct mail_data *md; + struct mail_message *msg; + int len, i, j; + + do { if (((void)(sd), +# 14657 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14657 "../../../server-code/src/map/clif.c" +)) return; } while(0); + md = &sd->mail.inbox; + len = 8 + (73 * md->amount); + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x240; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = md->amount; + for( i = j = 0; i < 30 && j < md->amount; i++ ) + { + msg = &md->msg[i]; + if (msg->id < 1) + continue; + + WFIFOL(fd,8+73*j) = msg->id; + memcpy(WFIFOP(fd,12+73*j), msg->title, 40); + WFIFOB(fd,52+73*j) = (msg->status != MAIL_UNREAD); + memcpy(WFIFOP(fd,53+73*j), msg->send_name, (23 + 1)); + WFIFOL(fd,77+73*j) = (uint32)msg->timestamp; + j++; + } + WFIFOSET(fd,len); + + if( md->full ) { + char output[100]; + sprintf(output, "Inbox is full (Max %d). Delete some mails.", 30); + clif->disp_message( &(sd)->bl, (output), (strlen(output)), SELF ); + } +} + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +{ + struct mail_data* md = &sd->mail.inbox; + + if( md->amount < 30 && (md->full || sd->mail.changed) ) + intif->Mail_requestinbox(sd->status.char_id, 1); + else + clif->mail_refreshinbox(sd); + + mail->removeitem(sd, 0); + mail->removezeny(sd, 0); +} + + + + + +void clif_Mail_read(struct map_session_data *sd, int mail_id) +{ + int i, fd = sd->fd; + + do { if (((void)(sd), +# 14711 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14711 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14712 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14712 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) { + clif->mail_return(sd->fd, mail_id, 1); + (showmsg->showWarning(("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n"), sd->status.name)); + return; + } else { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + struct item *item = &msg->item; + struct item_data *data; + size_t msg_len = strlen(msg->body), len; + + if( msg_len == 0 ) { + strcpy(msg->body, "(no message)"); + msg_len = strlen(msg->body); + } + + len = 101 + msg_len; + + WFIFOHEAD(fd,len); + WFIFOW(fd,0) = 0x242; + WFIFOW(fd,2) = len; + WFIFOL(fd,4) = msg->id; + (strlib->safestrncpy_((WFIFOP(fd,8)),(msg->title),(40 + 1))); + (strlib->safestrncpy_((WFIFOP(fd,48)),(msg->send_name),((23 + 1) + 1))); + WFIFOL(fd,72) = 0; + WFIFOL(fd,76) = msg->zeny; + + if( item->nameid && (data = itemdb->exists(item->nameid)) != +# 14739 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14739 "../../../server-code/src/map/clif.c" + ) { + WFIFOL(fd,80) = item->amount; + WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; + WFIFOW(fd,86) = data->type; + WFIFOB(fd,88) = item->identify; + WFIFOB(fd,89) = item->attribute; + WFIFOB(fd,90) = item->refine; + WFIFOW(fd,91) = item->card[0]; + WFIFOW(fd,93) = item->card[1]; + WFIFOW(fd,95) = item->card[2]; + WFIFOW(fd,97) = item->card[3]; + } else + memset(WFIFOP(fd,80), 0x00, 19); + + WFIFOB(fd,99) = (unsigned char)msg_len; + (strlib->safestrncpy_((WFIFOP(fd,100)),(msg->body),(msg_len + 1))); + WFIFOSET(fd,len); + + if (msg->status == MAIL_UNREAD) { + msg->status = MAIL_READ; + intif->Mail_read(mail_id); + clif->pMail_refreshinbox(fd, sd); + } + } +} + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_read(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + clif->mail_read(sd, RFIFOL(fd,2)); +} + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + +# 14787 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 14787 "../../../server-code/src/map/clif.c" + fail = +# 14787 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 14787 "../../../server-code/src/map/clif.c" + ; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14796 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14796 "../../../server-code/src/map/clif.c" +); + if( i == 30 ) + return; + + 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 > 0x7fffffff ) { + clif->mail_getattachment(fd, 1); + return; + } + + 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)) == +# 14812 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14812 "../../../server-code/src/map/clif.c" + ) + return; + + if( ( (sd)->weight*10 >= (sd)->max_weight*9 ) ) { + clif->mail_getattachment(fd, 2); + return; + } + + switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + case ADDITEM_NEW: + fail = ( pc->inventoryblank(sd) == 0 ); + break; + case ADDITEM_OVERAMOUNT: + fail = +# 14825 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14825 "../../../server-code/src/map/clif.c" + ; + } + + 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); + return; + } + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + + clif->mail_read(sd, mail_id); + intif->Mail_getattach(sd->status.char_id, mail_id); +} + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( !chrif->isconnected() ) + return; + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14863 "../../../server-code/src/map/clif.c" +); + if (i < 30) { + struct mail_message *msg = &sd->mail.inbox.msg[i]; + + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) { + clif->mail_delete(sd->fd, mail_id, 1); + return; + } + + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_delete(sd->status.char_id, mail_id); + } +} + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_return(int fd, struct map_session_data *sd) +{ + int mail_id = RFIFOL(fd,2); + int i; + + if( mail_id <= 0 ) + return; + if( mail->invalid_operation(sd) ) + return; + + do { for ((i) = (0); (i) < (30); ++(i)) if (sd->mail.inbox.msg[i].id == mail_id) break; } while( +# 14892 "../../../server-code/src/map/clif.c" 3 4 +0 +# 14892 "../../../server-code/src/map/clif.c" +); + if (i < 30 && sd->mail.inbox.msg[i].send_id != 0) { + sd->mail.inbox.msg[i].zeny = 0; + memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); + mail->clear(sd); + intif->Mail_return(sd->status.char_id, mail_id); + } else { + clif->mail_return(sd->fd, mail_id, 1); + } +} + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2); + int amount = RFIFOL(fd,4); + unsigned char flag; + + if( !chrif->isconnected() ) + return; + if (idx < 0 || amount < 0) + return; + + flag = mail->setitem(sd, idx, amount); + clif->mail_setattachment(fd,idx,flag); +} + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +{ + int flag = RFIFOW(fd,2); + + if (flag == 0 || flag == 1) + mail->removeitem(sd, 0); + if (flag == 0 || flag == 2) + mail->removezeny(sd, 0); +} + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Mail_send(int fd, struct map_session_data *sd) +{ + struct mail_message msg; + int body_len; + + if( !chrif->isconnected() ) + return; + if( sd->state.trading ) + return; + + if( RFIFOW(fd,2) < 69 ) { + (showmsg->showWarning(("Invalid Msg Len from account %d.\n"), sd->status.account_id)); + return; + } + + if( ((sd->cansendmail_tick)-(timer->gettick())) > 0 ) { + clif->message(sd->fd,atcommand->msgsd((sd),(875))); + clif->mail_send(fd, +# 14958 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14958 "../../../server-code/src/map/clif.c" + ); + return; + } + + body_len = RFIFOB(fd,68); + + if (body_len > 200) + body_len = 200; + + memset(&msg, 0, sizeof(msg)); + if (!mail->setattachment(sd, &msg)) { + clif->mail_send(sd->fd, +# 14969 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 14969 "../../../server-code/src/map/clif.c" + ); + mail->removeitem(sd,0); + mail->removezeny(sd,0); + return; + } + + msg.id = 0; + msg.send_id = sd->status.char_id; + msg.dest_id = 0; + (strlib->safestrncpy_((msg.send_name),(sd->status.name),((23 + 1)))); + (strlib->safestrncpy_((msg.dest_name),(RFIFOP(fd,4)),((23 + 1)))); + (strlib->safestrncpy_((msg.title),(RFIFOP(fd,28)),(40))); + + if (msg.title[0] == '\0') { + return; + } + + if (body_len) + (strlib->safestrncpy_((msg.body),(RFIFOP(fd,69)),(body_len + 1))); + else + memset(msg.body, 0x00, 200); + + msg.timestamp = time( +# 14991 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 14991 "../../../server-code/src/map/clif.c" + ); + if( !intif->Mail_send(sd->status.account_id, &msg) ) + mail->deliveryfail(sd, &msg); + + sd->cansendmail_tick = timer->gettick() + 1000; +} +# 15007 "../../../server-code/src/map/clif.c" +void clif_Auction_openwindow(struct map_session_data *sd) +{ + int fd; + + do { if (((void)(sd), +# 15011 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15011 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if (sd->state.storage_flag != STORAGE_FLAG_CLOSED || sd->state.vending || sd->state.buyingstore || sd->state.trading) + return; + + if( !battle_config.feature_auction ) + return; + + WFIFOHEAD(fd,packet_db[0x25f].len); + WFIFOW(fd,0) = 0x25f; + WFIFOL(fd,2) = 0; + WFIFOSET(fd,packet_db[0x25f].len); +} + + + +void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +{ + int i, fd, len = sizeof(struct auction_data); + struct auction_data auction; + struct item_data *item; + + do { if (((void)(sd), +# 15033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12 + (count * 83)); + WFIFOW(fd,0) = 0x252; + WFIFOW(fd,2) = 12 + (count * 83); + WFIFOL(fd,4) = pages; + WFIFOL(fd,8) = count; + + for( i = 0; i < count; i++ ) { + int k = 12 + (i * 83); + memcpy(&auction, RBUFP(buf,i * len), len); + + WFIFOL(fd,k) = auction.auction_id; + (strlib->safestrncpy_((WFIFOP(fd,4+k)),(auction.seller_name),((23 + 1)))); + + if( (item = itemdb->exists(auction.item.nameid)) != +# 15048 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15048 "../../../server-code/src/map/clif.c" + && item->view_id > 0 ) + WFIFOW(fd,28+k) = item->view_id; + else + WFIFOW(fd,28+k) = auction.item.nameid; + + WFIFOL(fd,30+k) = auction.type; + WFIFOW(fd,34+k) = auction.item.amount; + WFIFOB(fd,36+k) = auction.item.identify; + WFIFOB(fd,37+k) = auction.item.attribute; + WFIFOB(fd,38+k) = auction.item.refine; + WFIFOW(fd,39+k) = auction.item.card[0]; + WFIFOW(fd,41+k) = auction.item.card[1]; + WFIFOW(fd,43+k) = auction.item.card[2]; + WFIFOW(fd,45+k) = auction.item.card[3]; + WFIFOL(fd,47+k) = auction.price; + WFIFOL(fd,51+k) = auction.buynow; + (strlib->safestrncpy_((WFIFOP(fd,55+k)),(auction.buyer_name),((23 + 1)))); + WFIFOL(fd,79+k) = (uint32)auction.timestamp; + } + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + + +void clif_Auction_setitem(int fd, int index, +# 15075 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15075 "../../../server-code/src/map/clif.c" + fail) { + WFIFOHEAD(fd,packet_db[0x256].len); + WFIFOW(fd,0) = 0x256; + WFIFOW(fd,2) = index; + WFIFOB(fd,4) = fail; + WFIFOSET(fd,packet_db[0x256].len); +} + +void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + +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); + + sd->auction.amount = 0; +} + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +{ + int idx = RFIFOW(fd,2) - 2; + int amount = RFIFOL(fd,4); + struct item_data *item; + + if( !battle_config.feature_auction ) + return; + + if( sd->auction.amount > 0 ) + sd->auction.amount = 0; + + if( idx < 0 || idx >= 100 ) { + (showmsg->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 ) { + (showmsg->showWarning(("Character %s trying to set invalid amount in auctions.\n"), sd->status.name)); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[idx].nameid)) != +# 15123 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15123 "../../../server-code/src/map/clif.c" + && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) + { + clif->auction_setitem(sd->fd, idx, +# 15125 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15125 "../../../server-code/src/map/clif.c" + ); + return; + } + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) || sd->status.inventory[idx].expire_time || + !sd->status.inventory[idx].identify || + !(itemdb->isrestricted((&sd->status.inventory[idx]), (( (sd)->group->level )), 0, itemdb->canauction_sub)) || + (sd->status.inventory[idx].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) )) ) { + clif->auction_setitem(sd->fd, idx, +# 15133 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15133 "../../../server-code/src/map/clif.c" + ); + return; + } + + sd->auction.index = idx; + sd->auction.amount = amount; + clif->auction_setitem(fd, idx + 2, +# 15139 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15139 "../../../server-code/src/map/clif.c" + ); +} +# 15155 "../../../server-code/src/map/clif.c" +void clif_Auction_message(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x250].len); + WFIFOW(fd,0) = 0x250; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,packet_db[0x250].len); +} + + + + + + + +void clif_Auction_close(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,packet_db[0x25e].len); + WFIFOW(fd,0) = 0x25d; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,packet_db[0x25e].len); +} + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_register(int fd, struct map_session_data *sd) +{ + struct auction_data auction; + struct item_data *item; + + if (!battle_config.feature_auction) + return; + + do { if (( (sd->auction.index >= 0 && sd->auction.index < 100) ? +# 15188 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15188 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 15188, __func__, "sd->auction.index >= 0 && sd->auction.index < 100", "failed assertion"), +# 15188 "../../../server-code/src/map/clif.c" 3 4 +1 +# 15188 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&auction, 0, sizeof(auction)); + auction.price = RFIFOL(fd,2); + auction.buynow = RFIFOL(fd,6); + auction.hours = RFIFOW(fd,10); + + + if (auction.price <= 0 || auction.buynow <= 0) { + (showmsg->showWarning(("Character %s trying to register auction wit wrong price.\n"), sd->status.name)); + return; + } + + if( sd->auction.amount < 1 ) { + (showmsg->showWarning(("Character %s trying to register auction without item.\n"), sd->status.name)); + return; + } + + if( auction.price >= auction.buynow ) { + (showmsg->showWarning(("Character %s trying to alter auction prices.\n"), sd->status.name)); + return; + } + + if( auction.hours < 1 || auction.hours > 48 ) { + (showmsg->showWarning(("Character %s trying to enter an invalid time for auction.\n"), sd->status.name)); + return; + } + + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif_Auction_message(fd, 5); + return; + } + + if( auction.buynow > battle_config.auction_maximumprice ) + { + auction.buynow = battle_config.auction_maximumprice; + if( auction.price >= auction.buynow ) + auction.price = auction.buynow - 1; + } + + auction.auction_id = 0; + auction.seller_id = sd->status.char_id; + (strlib->safestrncpy_((auction.seller_name),(sd->status.name),(sizeof(auction.seller_name)))); + auction.buyer_id = 0; + memset(auction.buyer_name, '\0', sizeof(auction.buyer_name)); + + if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) + { + clif->auction_message(fd, 2); + return; + } + + if( (item = itemdb->exists(sd->status.inventory[sd->auction.index].nameid)) == +# 15240 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15240 "../../../server-code/src/map/clif.c" + ) + { + clif->auction_message(fd, 2); + return; + } + + + if( sd->status.inventory[sd->auction.index].bound && !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE_BOUND)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE_BOUND)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(293))); + clif->auction_message(fd, 2); + return; + } + + (strlib->safestrncpy_((auction.item_name),(item->jname),(sizeof(auction.item_name)))); + auction.type = item->type; + memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item)); + auction.item.amount = 1; + auction.timestamp = 0; + + if( !intif->Auction_register(&auction) ) + clif->auction_message(fd, 4); + else + { + int zeny = auction.hours*battle_config.auction_feeperhour; + + pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, DELITEM_SOLD, LOG_TYPE_AUCTION); + sd->auction.amount = 0; + + pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, +# 15268 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15268 "../../../server-code/src/map/clif.c" + ); + } +} + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_cancel(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_close(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + + intif->Auction_close(sd->status.char_id, auction_id); +} + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +{ + unsigned int auction_id = RFIFOL(fd,2); + int bid = RFIFOL(fd,6); + + if( !( ( (((sd))->extra_temp_permissions&(PC_PERM_TRADE)) != 0 || (((sd))->group->e_permissions&(PC_PERM_TRADE)) != 0 ) ) ) { + clif->message(sd->fd, atcommand->msgsd((sd),(246))); + return; + } + + if( bid <= 0 ) + clif->auction_message(fd, 0); + else if( bid > sd->status.zeny ) + clif->auction_message(fd, 8); + else if ( intif->CheckForCharServer() ) + clif->auction_message(fd, 0); + else { + pc->payzeny(sd, bid, LOG_TYPE_AUCTION, +# 15312 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15312 "../../../server-code/src/map/clif.c" + ); + intif->Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); + } +} + +void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 15327 "../../../server-code/src/map/clif.c" +void clif_parse_Auction_search(int fd, struct map_session_data* sd) +{ + char search_text[(23 + 1)]; + short type = RFIFOW(fd,2), page = RFIFOW(fd,32); + int price = RFIFOL(fd,4); + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + (strlib->safestrncpy_((search_text),(RFIFOP(fd,8)),(sizeof(search_text)))); + intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); +} + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +{ + short type = RFIFOW(fd,2) + 6; + + if( !battle_config.feature_auction ) + return; + + clif->pAuction_cancelreg(fd, sd); + + intif->Auction_requestlist(sd->status.char_id, type, 0, "", 1); +} + + + + + + + +void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { + struct npc_item_list *shop = +# 15367 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15367 "../../../server-code/src/map/clif.c" + ; + unsigned short shop_size = 0; + int fd,i, c = 0; + int currency[2] = { 0,0 }; + + + + const int offset = 12; + + + do { if (((void)(sd), +# 15377 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15377 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 15378 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15378 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( nd->subtype == SCRIPT ) { + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + + npc->trader_count_funds(nd, sd); + + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + shop = nd->u.shop.shop_item; + shop_size = nd->u.shop.count; + + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + fd = sd->fd; + sd->npc_shopid = nd->bl.id; + WFIFOHEAD(fd,offset+shop_size*11); + WFIFOW(fd,0) = 0x287; + + WFIFOL(fd,4) = currency[0]; + + WFIFOL(fd,8) = currency[1]; + + + for( i = 0; i < shop_size; i++ ) { + if( shop[i].nameid ) { + struct item_data* id = itemdb->search(shop[i].nameid); + WFIFOL(fd,offset+0+i*11) = shop[i].value; + WFIFOL(fd,offset+4+i*11) = shop[i].value; + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + WFIFOW(fd,2) = offset+c*11; + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + + + +void clif_cashshop_ack(struct map_session_data* sd, int error) { + struct npc_data *nd; + int fd; + int currency[2] = { 0,0 }; + + do { if (((void)(sd), +# 15429 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15429 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { + npc->trader_count_funds(nd,sd); + currency[0] = npc->trader_funds[0]; + currency[1] = npc->trader_funds[1]; + } else { + currency[0] = sd->cashPoints; + currency[1] = sd->kafraPoints; + } + + WFIFOHEAD(fd, packet_db[0x289].len); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = currency[0]; + + + + WFIFOL(fd,6) = currency[1]; + WFIFOW(fd,10) = TOW(error); + + WFIFOSET(fd, packet_db[0x289].len); +} + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +{ + int fail = 0; + + if( sd->state.trading || !sd->npc_shopid || ( ((sd)->extra_temp_permissions&(PC_PERM_DISABLE_STORE)) != 0 || ((sd)->group->e_permissions&(PC_PERM_DISABLE_STORE)) != 0 ) ) + fail = 1; + else { + + + + + + + + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( len < 10 || len != 10 + count * 4) { + (showmsg->showWarning(("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n"), sd->status.char_id, len, 10 + count * 4)); + return; + } + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._data_ ) = +# 15482 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15482 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 15482, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); } } while( +# 15482 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15482 "../../../server-code/src/map/clif.c" + ); + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.amount = RFIFOW(fd, 10 + 4 * i); + entry.id = RFIFOW(fd, 10 + 4 * i + 2); + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 15489 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15489 "../../../server-code/src/map/clif.c" + ); + } + fail = npc->cashshop_buylist(sd, points, &item_list); + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 15492, __func__)); ( (item_list)._data_ ) = +# 15492 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15492 "../../../server-code/src/map/clif.c" + ; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 15492 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15492 "../../../server-code/src/map/clif.c" + ); + + } + + clif->cashshop_ack(sd,fail); +} +# 15508 "../../../server-code/src/map/clif.c" +void clif_Adopt_reply(struct map_session_data *sd, int type) +{ + int fd; + + do { if (((void)(sd), +# 15512 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15512 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x216; + WFIFOL(fd,2) = type; + WFIFOSET(fd,6); +} + + + +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { + int fd; + + do { if (((void)(sd), +# 15525 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15525 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(src), +# 15526 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15526 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,34); + WFIFOW(fd,0) = 0x1f6; + WFIFOL(fd,2) = src->status.account_id; + WFIFOL(fd,6) = p_id; + memcpy(WFIFOP(fd,10), src->status.name, (23 + 1)); + WFIFOSET(fd,34); +} + +void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +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) ) { + tsd->adopt_invite = sd->status.account_id; + clif->adopt_request(tsd, sd, p_sd->status.account_id); + } +} + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { + int p1_id = RFIFOL(fd,2); + int p2_id = RFIFOL(fd,6); + int result = RFIFOL(fd,10); + struct map_session_data* p1_sd = map->id2sd(p1_id); + struct map_session_data* p2_sd = map->id2sd(p2_id); + + int pid = sd->adopt_invite; + sd->adopt_invite = 0; + + if( p1_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + || p2_sd == +# 15564 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15564 "../../../server-code/src/map/clif.c" + ) + return; + + if( pid != p1_sd->status.account_id ) + return; + + if( result == 0 ) + return; + + pc->adoption(p1_sd, p2_sd, sd); +} +# 15583 "../../../server-code/src/map/clif.c" +void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +{ + WFIFOHEAD(fd,70); + memset(WFIFOP(fd,0),0,70); + WFIFOW(fd,0) = 0x293; + + if( md != +# 15589 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15589 "../../../server-code/src/map/clif.c" + ) { + if( md->bl.prev != +# 15590 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15590 "../../../server-code/src/map/clif.c" + ) { + if( flag ) { + WFIFOB(fd,2) = 1; + WFIFOL(fd,3) = md->bl.x; + WFIFOL(fd,7) = md->bl.y; + } else + WFIFOB(fd,2) = 2; + } else if (md->spawn_timer != (-1)) { + const struct TimerData * timer_data = timer->get(md->spawn_timer); + unsigned int seconds; + int hours, minutes; + + seconds = (unsigned int)(((timer_data->tick)-(timer->gettick())) / 1000 + 60); + hours = seconds / (60 * 60); + seconds = seconds - (60 * 60 * hours); + minutes = seconds / 60; + + WFIFOB(fd,2) = 3; + WFIFOW(fd,11) = hours; + WFIFOW(fd,13) = minutes; + } + (strlib->safestrncpy_((WFIFOP(fd,19)),(md->db->jname),((23 + 1)))); + } + + WFIFOSET(fd,70); +} + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { + int charid = RFIFOL(fd, 2); + struct map_session_data* tsd = map->id2sd(charid); + + if (!tsd) + return; + + if( tsd->status.show_equip || ( ((sd)->extra_temp_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 || ((sd)->group->e_permissions&(PC_PERM_VIEW_EQUIPMENT)) != 0 ) ) + clif->viewequip_ack(sd, tsd); + else + clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); +} + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_EquipTick(int fd, struct map_session_data* sd) +{ + +# 15643 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15643 "../../../server-code/src/map/clif.c" + flag = (RFIFOL(fd,6) != 0) ? +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15643 "../../../server-code/src/map/clif.c" + : +# 15643 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15643 "../../../server-code/src/map/clif.c" + ; + sd->status.show_equip = flag; + clif->equiptickack(sd, flag); +} + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_PartyTick(int fd, struct map_session_data* sd) +{ + +# 15655 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 15655 "../../../server-code/src/map/clif.c" + flag = RFIFOB(fd,6)? +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15655 "../../../server-code/src/map/clif.c" + : +# 15655 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15655 "../../../server-code/src/map/clif.c" + ; + sd->status.allow_party = flag; + clif->partytickack(sd, flag); +} + + + + + + + +void clif_quest_send_list(struct map_session_data *sd) +{ + int i, len, real_len; + uint8 *buf = +# 15669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15669 "../../../server-code/src/map/clif.c" + ; + struct packet_quest_list_header *packet = +# 15670 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15670 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(sd), +# 15671 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15671 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + len = sizeof(struct packet_quest_list_header) + + sd->avail_quests * (sizeof(struct packet_quest_list_info) + + 3 * sizeof(struct packet_mission_info_sub)); + buf = (iMalloc->malloc((len),"../../../server-code/src/map/clif.c", 15676, __func__)); + packet = WBUFP(buf, 0); + real_len = sizeof(*packet); + + packet->PacketType = questListType; + packet->questCount = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct packet_quest_list_info *info = (struct packet_quest_list_info *)(buf+real_len); + + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + int j; + + real_len += sizeof(*info); + + info->questID = sd->quest_log[i].quest_id; + info->active = sd->quest_log[i].state; + + info->quest_svrTime = sd->quest_log[i].time - qi->time; + info->quest_endTime = sd->quest_log[i].time; + info->hunting_count = qi->objectives_count; + + for (j = 0; j < qi->objectives_count; j++) { + struct mob_db *mob_data; + if (( (j < 3) ? +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 15700 "../../../server-code/src/map/clif.c" + : (nullpo->assert_report("../../../server-code/src/map/clif.c", 15700, __func__, "j < 3", "failed assertion"), +# 15700 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 15700 "../../../server-code/src/map/clif.c" + ) )) break; else (void)0; + real_len += sizeof(info->objectives[j]); + + mob_data = mob->db(qi->objectives[j].mob); + + info->objectives[j].mob_id = qi->objectives[j].mob; + info->objectives[j].huntCount = sd->quest_log[i].count[j]; + info->objectives[j].maxCount = qi->objectives[j].count; + (strlib->safestrncpy_((info->objectives[j].mobName),(mob_data->jname),(sizeof(info->objectives[j].mobName)))); + } + + } + packet->PacketLength = real_len; + clif->send(buf, real_len, &sd->bl, SELF); + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 15714, __func__)); +} + + + +void clif_quest_send_mission(struct map_session_data *sd) +{ + int fd = sd->fd; + int i, j; + int len; + struct mob_db *monster; + + do { if (((void)(sd), +# 15726 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15726 "../../../server-code/src/map/clif.c" +)) return; } while(0); + len = sd->avail_quests*104+8; + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b2; + WFIFOW(fd,2) = len; + WFIFOL(fd, 4) = sd->avail_quests; + + for (i = 0; i < sd->avail_quests; i++) { + struct quest_db *qi = quest->db(sd->quest_log[i].quest_id); + WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time; + WFIFOL(fd, i*104+16) = sd->quest_log[i].time; + WFIFOW(fd,i*104+20) = qi->objectives_count; + + for (j = 0 ; j < qi->objectives_count; j++) { + WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob; + WFIFOW(fd,i*104+26+j*30) = sd->quest_log[i].count[j]; + monster = mob->db(qi->objectives[j].mob); + memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, (23 + 1)); + } + } + + WFIFOSET(fd, len); +} + + + +void clif_quest_add(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + + do { if (((void)(sd), +# 15759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + WFIFOHEAD(fd, packet_db[0x2b3].len); + WFIFOW(fd,0) = 0x2b3; + WFIFOL(fd, 2) = qd->quest_id; + WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - qi->time; + WFIFOL(fd, 11) = qd->time; + WFIFOW(fd,15) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + struct mob_db *monster; + WFIFOL(fd, i*30+17) = qi->objectives[i].mob; + WFIFOW(fd,i*30+21) = qd->count[i]; + monster = mob->db(qi->objectives[i].mob); + memcpy(WFIFOP(fd, i*30+23), monster->jname, (23 + 1)); + } + + WFIFOSET(fd, packet_db[0x2b3].len); +} + + + +void clif_quest_delete(struct map_session_data *sd, int quest_id) { + int fd; + + do { if (((void)(sd), +# 15787 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15787 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b4].len); + WFIFOW(fd,0) = 0x2b4; + WFIFOL(fd, 2) = quest_id; + WFIFOSET(fd, packet_db[0x2b4].len); +} + + + +void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +{ + int fd; + int i; + struct quest_db *qi; + int len; + + do { if (((void)(sd), +# 15804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(qd), +# 15805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15805 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + qi = quest->db(qd->quest_id); + len = qi->objectives_count * 12 + 6; + + WFIFOHEAD(fd, len); + WFIFOW(fd,0) = 0x2b5; + WFIFOW(fd,2) = len; + WFIFOW(fd,4) = qi->objectives_count; + + for (i = 0; i < qi->objectives_count; i++) { + WFIFOL(fd, i*12+6) = qd->quest_id; + WFIFOL(fd, i*12+10) = qi->objectives[i].mob; + WFIFOW(fd,i*12+14) = qi->objectives[i].count; + WFIFOW(fd,i*12+16) = qd->count[i]; + } + + WFIFOSET(fd, len); +} + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + +void clif_parse_questStateAck(int fd, struct map_session_data *sd) { + quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); +} + + + +void clif_quest_update_status(struct map_session_data *sd, int quest_id, +# 15834 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 15834 "../../../server-code/src/map/clif.c" + active) { + int fd; + + do { if (((void)(sd), +# 15837 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15837 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x2b7].len); + WFIFOW(fd,0) = 0x2b7; + WFIFOL(fd, 2) = quest_id; + WFIFOB(fd, 6) = active; + WFIFOSET(fd, packet_db[0x2b7].len); +} +# 15857 "../../../server-code/src/map/clif.c" +void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +{ + + int fd; + + do { if (((void)(sd), +# 15862 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15862 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(bl), +# 15863 "../../../server-code/src/map/clif.c" 3 4 +0 +# 15863 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd, packet_db[0x446].len); + WFIFOW(fd,0) = 0x446; + WFIFOL(fd, 2) = bl->id; + WFIFOW(fd,6) = bl->x; + WFIFOW(fd,8) = bl->y; + WFIFOW(fd,10) = state; + WFIFOW(fd,12) = color; + WFIFOSET(fd, packet_db[0x446].len); + +} + + + + + + +void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { + struct mercenary_data *md; + struct status_data *mstatus; + int fd; + if( sd == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15885 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15885 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + WFIFOHEAD(fd,packet_db[0x2a2].len); + WFIFOW(fd,0) = 0x2a2; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_ATK1: + { + int atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk; + WFIFOL(fd,4) = (((atk) >= ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + )) ? ( +# 15897 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15897 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + } + break; + case SP_MATK1: + WFIFOL(fd,4) = (((mstatus->matk_max) >= ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + )) ? ( +# 15901 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15901 "../../../server-code/src/map/clif.c" + ) : ((mstatus->matk_max) <= (0)) ? (0) : (mstatus->matk_max)); + break; + case SP_HIT: + WFIFOL(fd,4) = mstatus->hit; + break; + case SP_CRITICAL: + WFIFOL(fd,4) = mstatus->cri/10; + break; + case SP_DEF1: + WFIFOL(fd,4) = mstatus->def; + break; + case SP_MDEF1: + WFIFOL(fd,4) = mstatus->mdef; + break; + case SP_MERCFLEE: + WFIFOL(fd,4) = mstatus->flee; + break; + case SP_ASPD: + WFIFOL(fd,4) = mstatus->amotion; + break; + case SP_HP: + WFIFOL(fd,4) = mstatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = mstatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = mstatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = mstatus->max_sp; + break; + case SP_MERCKILLS: + WFIFOL(fd,4) = md->mercenary.kill_count; + break; + case SP_MERCFAITH: + WFIFOL(fd,4) = mercenary->get_faith(md); + break; + } + WFIFOSET(fd,packet_db[0x2a2].len); +} + + + + + +void clif_mercenary_info(struct map_session_data *sd) { + int fd; + struct mercenary_data *md; + struct status_data *mstatus; + int atk; + + if( sd == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 15953 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15953 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + mstatus = &md->battle_status; + + WFIFOHEAD(fd,packet_db[0x29b].len); + WFIFOW(fd,0) = 0x29b; + WFIFOL(fd,2) = md->bl.id; + + + + atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0); + + + + WFIFOW(fd,6) = (((atk) >= ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + )) ? ( +# 15969 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15969 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl)); + WFIFOW(fd,8) = (((atk) >= ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + )) ? ( +# 15972 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 15972 "../../../server-code/src/map/clif.c" + ) : ((atk) <= (0)) ? (0) : (atk)); + + + + WFIFOW(fd,10) = mstatus->hit; + WFIFOW(fd,12) = mstatus->cri/10; + + WFIFOW(fd,14) = mstatus->def2; + WFIFOW(fd,16) = mstatus->mdef2; + + + + + WFIFOW(fd,18) = mstatus->flee; + WFIFOW(fd,20) = mstatus->amotion; + (strlib->safestrncpy_((WFIFOP(fd,22)),(md->db->name),((23 + 1)))); + WFIFOW(fd,46) = md->db->lv; + WFIFOL(fd,48) = mstatus->hp; + WFIFOL(fd,52) = mstatus->max_hp; + WFIFOL(fd,56) = mstatus->sp; + WFIFOL(fd,60) = mstatus->max_sp; + WFIFOL(fd,64) = (int)time( +# 15993 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 15993 "../../../server-code/src/map/clif.c" + ) + (mercenary->get_lifetime(md) / 1000); + WFIFOW(fd,68) = mercenary->get_faith(md); + WFIFOL(fd,70) = mercenary->get_calls(md); + WFIFOL(fd,74) = md->mercenary.kill_count; + WFIFOW(fd,78) = md->battle_status.rhw.range; + WFIFOSET(fd,packet_db[0x29b].len); +} + + + +void clif_mercenary_skillblock(struct map_session_data *sd) +{ + struct mercenary_data *md; + int fd, i, len = 4, j; + + if( sd == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + || (md = sd->md) == +# 16008 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16008 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + WFIFOHEAD(fd,4+37*40); + WFIFOW(fd,0) = 0x29d; + for (i = 0; i < 40; i++) { + int id = md->db->skill[i].id; + if (id == 0) + continue; + j = id - 8201; + WFIFOW(fd,len) = id; + WFIFOL(fd,len+2) = skill->get_inf(id); + WFIFOW(fd,len+6) = md->db->skill[j].lv; + if ( md->db->skill[j].lv ) { + WFIFOW(fd,len + 8) = skill->get_sp(id, md->db->skill[j].lv); + WFIFOW(fd,len + 10) = skill->get_range2(&md->bl, id, md->db->skill[j].lv); + } else { + WFIFOW(fd,len + 8) = 0; + WFIFOW(fd,len + 10) = 0; + } + (strlib->safestrncpy_((WFIFOP(fd,len+12)),(skill->get_name(id)),((23 + 1)))); + WFIFOB(fd,len+36) = 0; + len += 37; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,len); +} + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + +void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +{ + int option = RFIFOB(fd,2); + if (sd->md == +# 16046 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16046 "../../../server-code/src/map/clif.c" + ) + return; + + if (option == 2) + mercenary->delete(sd->md, 2); +} + + + + + + + +void clif_mercenary_message(struct map_session_data* sd, int message) +{ + clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +} + + + +void clif_rental_time(int fd, int nameid, int seconds) +{ + WFIFOHEAD(fd,packet_db[0x298].len); + WFIFOW(fd,0) = 0x298; + WFIFOW(fd,2) = nameid; + WFIFOL(fd,4) = seconds; + WFIFOSET(fd,packet_db[0x298].len); +} + + + +void clif_rental_expired(int fd, int index, int nameid) +{ + WFIFOHEAD(fd,packet_db[0x299].len); + WFIFOW(fd,0) = 0x299; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x299].len); +} + + + +void clif_readbook(int fd, int book_id, int page) +{ + WFIFOHEAD(fd,packet_db[0x294].len); + WFIFOW(fd,0) = 0x294; + WFIFOL(fd,2) = book_id; + WFIFOL(fd,6) = page; + WFIFOSET(fd,packet_db[0x294].len); +} + + + + + + +void clif_bg_hp(struct map_session_data *sd) +{ + unsigned char buf[34]; + const int cmd = 0x2e0; + do { if (((void)(sd), +# 16106 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16106 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = cmd; + WBUFL(buf,2) = sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + + if( sd->battle_status.max_hp > +# 16112 "../../../server-code/src/map/clif.c" 3 4 + (32767) +# 16112 "../../../server-code/src/map/clif.c" + ) + { + WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFW(buf,32) = 100; + } + else + { + WBUFW(buf,30) = sd->battle_status.hp; + WBUFW(buf,32) = sd->battle_status.max_hp; + } + + clif->send(buf, packet_db[cmd].len, &sd->bl, BG_AREA_WOS); +} + + + +void clif_bg_xy(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16131 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16131 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memcpy(WBUFP(buf,6), sd->status.name, (23 + 1)); + WBUFW(buf,30)=sd->status.class_; + WBUFW(buf,32)=sd->bl.x; + WBUFW(buf,34)=sd->bl.y; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + +void clif_bg_xy_remove(struct map_session_data *sd) +{ + unsigned char buf[36]; + do { if (((void)(sd), +# 16146 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16146 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0)=0x2df; + WBUFL(buf,2)=sd->status.account_id; + memset(WBUFP(buf,6), 0, (23 + 1)); + WBUFW(buf,30)=0; + WBUFW(buf,32)=-1; + WBUFW(buf,34)=-1; + + clif->send(buf, packet_db[0x2df].len, &sd->bl, BG_SAMEMAP_WOS); +} + + + +void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) +{ + struct map_session_data *sd; + unsigned char *buf; + + do { if (((void)(bgd), +# 16165 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16165 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(name), +# 16166 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16166 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(mes), +# 16167 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16167 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if( !bgd->count || (sd = bg->getavailablesd(bgd)) == +# 16168 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16168 "../../../server-code/src/map/clif.c" + ) + return; + + buf = (unsigned char*)(iMalloc->malloc(((len + (23 + 1) + 8)*sizeof(unsigned char)),"../../../server-code/src/map/clif.c", 16171, __func__)); + + WBUFW(buf,0) = 0x2dc; + WBUFW(buf,2) = len + (23 + 1) + 8; + WBUFL(buf,4) = src_id; + memcpy(WBUFP(buf,8), name, (23 + 1)); + memcpy(WBUFP(buf,32), mes, len); + clif->send(buf,WBUFW(buf,2), &sd->bl, BG); + + (iMalloc->free((buf),"../../../server-code/src/map/clif.c", 16180, __func__)); +} + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_BattleChat(int fd, struct map_session_data* sd) +{ + const char *text = RFIFOP(fd,4); + int textlen = RFIFOW(fd,2) - 4; + + const char *name, *message; + size_t namelen, messagelen; + + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + return; + + if( atcommand->exec(fd, sd, message, +# 16197 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 16197 "../../../server-code/src/map/clif.c" + ) ) + return; + + if( !pc->can_talk(sd) ) + return; + + if( battle_config.min_chat_delay ) { + if( ((sd->cantalk_tick)-(timer->gettick())) > 0 ) + return; + sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; + } + + pc->update_idle_time(sd, BCIDLE_CHAT); + + bg->send_message(sd, text, textlen); +} + + + +void clif_bg_updatescore(int16 m) { + struct block_list bl; + unsigned char buf[6]; + + bl.id = 0; + bl.type = BL_NUL; + bl.m = m; + + WBUFW(buf,0) = 0x2de; + WBUFW(buf,2) = map->list[m].bgscore_lion; + WBUFW(buf,4) = map->list[m].bgscore_eagle; + clif->send(buf,packet_db[0x2de].len,&bl,ALL_SAMEMAP); +} + +void clif_bg_updatescore_single(struct map_session_data *sd) { + int fd; + do { if (((void)(sd), +# 16232 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16232 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + + WFIFOHEAD(fd,packet_db[0x2de].len); + WFIFOW(fd,0) = 0x2de; + WFIFOW(fd,2) = map->list[sd->bl.m].bgscore_lion; + WFIFOW(fd,4) = map->list[sd->bl.m].bgscore_eagle; + WFIFOSET(fd,packet_db[0x2de].len); +} + + + +void clif_sendbgemblem_area(struct map_session_data *sd) +{ + unsigned char buf[33]; + do { if (((void)(sd), +# 16247 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16247 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x2dd; + WBUFL(buf,2) = sd->bl.id; + (strlib->safestrncpy_((WBUFP(buf,6)),(sd->status.name),((23 + 1)))); + WBUFW(buf,30) = sd->bg_id; + clif->send(buf,packet_db[0x2dd].len, &sd->bl, AREA); +} + +void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +{ + do { if (((void)(sd), +# 16258 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16258 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(fd,32); + WFIFOW(fd,0) = 0x2dd; + WFIFOL(fd,2) = sd->bl.id; + (strlib->safestrncpy_((WFIFOP(fd,6)),(sd->status.name),((23 + 1)))); + WFIFOW(fd,30) = sd->bg_id; + WFIFOSET(fd,packet_db[0x2dd].len); +} + + + +void clif_font(struct map_session_data *sd) +{ + + unsigned char buf[8]; + do { if (((void)(sd), +# 16273 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16273 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2ef; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->status.font; + clif->send(buf, packet_db[0x2ef].len, &sd->bl, AREA); + +} + + + + +int clif_instance(int instance_id, int type, int flag) { + struct map_session_data *sd = +# 16285 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16285 "../../../server-code/src/map/clif.c" + ; + unsigned char buf[255]; + enum send_target target = PARTY; + + switch( instance->list[instance_id].owner_type ) { + case IOT_NONE: + return 0; + case IOT_GUILD: + target = GUILD; + sd = guild->getavailablesd(guild->search(instance->list[instance_id].owner_id)); + break; + case IOT_PARTY: + + sd = party->getavailablesd(party->search(instance->list[instance_id].owner_id)); + break; + case IOT_CHAR: + target = SELF; + sd = map->id2sd(instance->list[instance_id].owner_id); + break; + } + + if( !sd ) + return 0; + + switch( type ) { + case 1: + + + + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,(60+1)); + WBUFW(buf,63) = flag; + clif->send(buf,packet_db[0x02CB].len,&sd->bl,target); + break; + case 2: + + + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_db[0x02CC].len,&sd->bl,target); + break; + case 3: + case 4: + + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance->list[instance_id].name,61); + if( type == 3 ) { + WBUFL(buf,63) = instance->list[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } else { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = instance->list[instance_id].idle_timeout; + } + clif->send(buf,packet_db[0x02CD].len,&sd->bl,target); + break; + case 5: + + + + + + + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + + clif->send(buf,packet_db[0x02CE].len,&sd->bl,target); + break; + } + return 0; +} + +void clif_instance_join(int fd, int instance_id) +{ + if( instance->list[instance_id].idle_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = 0; + WFIFOL(fd,67) = instance->list[instance_id].idle_timeout; + WFIFOSET(fd,packet_db[0x02CD].len); + } else if( instance->list[instance_id].progress_timer != (-1) ) { + WFIFOHEAD(fd,packet_db[0x02CD].len); + WFIFOW(fd,0) = 0x02CD; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOL(fd,63) = instance->list[instance_id].progress_timeout; + WFIFOL(fd,67) = 0; + WFIFOSET(fd,packet_db[0x02CD].len); + } else { + WFIFOHEAD(fd,packet_db[0x02CB].len); + WFIFOW(fd,0) = 0x02CB; + memcpy(WFIFOP(fd,2),instance->list[instance_id].name,61); + WFIFOW(fd,63) = 0; + WFIFOSET(fd,packet_db[0x02CB].len); + } +} + +void clif_instance_leave(int fd) +{ + WFIFOHEAD(fd,packet_db[0x02CE].len); + WFIFOW(fd,0) = 0x02ce; + WFIFOL(fd,2) = 4; + WFIFOSET(fd,packet_db[0x02CE].len); +} + + + +void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +{ + + unsigned char buf[22]; + struct item_data* id; + + do { if (((void)(sd), +# 16397 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16397 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_data), +# 16398 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16398 "../../../server-code/src/map/clif.c" +)) return; } while(0); + id = itemdb->search(item_data->nameid); + WBUFW(buf,0) = 0x2b8; + WBUFL(buf,2) = sd->status.account_id; + WBUFW(buf,6) = item_data->nameid; + 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); + WBUFW(buf,19) = id->equip; + WBUFB(buf,21) = itemtype(id->type); + clif->send(buf, packet_db[0x2b8].len, &sd->bl, PARTY_SAMEMAP_WOS); + +} +# 16420 "../../../server-code/src/map/clif.c" +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, +# 16420 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 16420 "../../../server-code/src/map/clif.c" + is_quest) { + int fd; + + do { if (((void)(sd), +# 16423 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16423 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + + WFIFOHEAD(fd, packet_db[0x7f6].len); + WFIFOW(fd,0) = 0x7f6; + WFIFOL(fd,2) = sd->bl.id; + WFIFOL(fd,6) = exp; + WFIFOW(fd,10) = type; + WFIFOW(fd,12) = is_quest?1:0; + WFIFOSET(fd,packet_db[0x7f6].len); +} +# 16444 "../../../server-code/src/map/clif.c" +void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +{ + do { if (((void)(sd), +# 16446 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16446 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WFIFOHEAD(sd->fd, packet_db[0x1b1].len); + WFIFOW(sd->fd,0) = 0x1b1; + WFIFOB(sd->fd,2) = type; + WFIFOL(sd->fd,3) = value; + WFIFOSET(sd->fd, packet_db[0x1b1].len); +} + +void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16467 "../../../server-code/src/map/clif.c" +void clif_parse_LessEffect(int fd, struct map_session_data* sd) +{ + int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + sd->state.lesseffect = ( isLess != 0 ); +} + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +{ + int n = ((int)RFIFOW(fd,2) - 12) / 4; + int type = RFIFOL(fd,4); + int flag = RFIFOL(fd,8); + struct itemlist item_list = { 0 }; + int i; + + if( sd->state.trading || sd->npc_shopid ) + return; + + if (flag == 0 || n <= 0) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + if (n > 100) + n = 100; + + if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((n) > _empty_) { while ((n) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._data_ ) = +# 16501 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16501 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 16501, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); } } while( +# 16501 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16501 "../../../server-code/src/map/clif.c" +); + for (i = 0; i < n; i++) { + struct itemlist_entry entry = { 0 }; + entry.id = (int)RFIFOW(fd, 12 + 4 * i) - 2; + entry.amount = RFIFOW(fd, 12 + 4 * i + 2); + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 16506 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 16506 "../../../server-code/src/map/clif.c" + ); + } + + switch( type ) { + case 0: + skill->changematerial(sd, &item_list); + break; + case 1: + case 2: + skill->elementalanalysis(sd, type, &item_list); + break; + } + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 16518, __func__)); ( (item_list)._data_ ) = +# 16518 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 16518 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 16518 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16518 "../../../server-code/src/map/clif.c" +); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + + return; +} + + + + +void clif_elemental_updatestatus(struct map_session_data *sd, int type) { + struct elemental_data *ed; + struct status_data *estatus; + int fd; + + if( sd == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16532 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16532 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + WFIFOHEAD(fd,8); + WFIFOW(fd,0) = 0x81e; + WFIFOW(fd,2) = type; + switch( type ) { + case SP_HP: + WFIFOL(fd,4) = estatus->hp; + break; + case SP_MAXHP: + WFIFOL(fd,4) = estatus->max_hp; + break; + case SP_SP: + WFIFOL(fd,4) = estatus->sp; + break; + case SP_MAXSP: + WFIFOL(fd,4) = estatus->max_sp; + break; + } + WFIFOSET(fd,8); +} + +void clif_elemental_info(struct map_session_data *sd) { + int fd; + struct elemental_data *ed; + struct status_data *estatus; + + if( sd == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + || (ed = sd->ed) == +# 16562 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 16562 "../../../server-code/src/map/clif.c" + ) + return; + + fd = sd->fd; + estatus = &ed->battle_status; + + WFIFOHEAD(fd,22); + WFIFOW(fd,0) = 0x81d; + WFIFOL(fd, 2) = ed->bl.id; + WFIFOL(fd, 6) = estatus->hp; + WFIFOL(fd,10) = estatus->max_hp; + WFIFOL(fd,14) = estatus->sp; + WFIFOL(fd,18) = estatus->max_sp; + WFIFOSET(fd,22); +} + + + + + + +void clif_buyingstore_open(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 16587 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16587 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x810].len); + WFIFOW(fd,0) = 0x810; + WFIFOB(fd,2) = sd->buyingstore.slots; + WFIFOSET(fd,packet_db[0x810].len); +} + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + + + +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 8; + const uint8 *itemlist; + char storename[(79 + 1)]; + unsigned char result; + int zenylimit; + unsigned int count, packet_len; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + + if( packet_len < 89 ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 89U, packet_len, sd->bl.id)); + return; + } + + zenylimit = RFIFOL(fd,info->pos[1]); + result = RFIFOL(fd,info->pos[2]); + (strlib->safestrncpy_((storename),(RFIFOP(fd,info->pos[3])),(sizeof(storename)))); + itemlist = RFIFOP(fd,info->pos[4]); + + + packet_len-= info->pos[4]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqOpenBuyingStore: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->create(sd, zenylimit, result, storename, itemlist, count); +} +# 16644 "../../../server-code/src/map/clif.c" +void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +{ + int fd; + + do { if (((void)(sd), +# 16648 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16648 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x812].len); + WFIFOW(fd,0) = 0x812; + WFIFOW(fd,2) = result; + WFIFOL(fd,4) = weight; + WFIFOSET(fd,packet_db[0x812].len); +} + + + +void clif_buyingstore_myitemlist(struct map_session_data* sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16664 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16664 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,12+sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x813; + WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; + WFIFOL(fd,4) = sd->bl.id; + WFIFOL(fd,8) = sd->buyingstore.zenylimit; + + for( i = 0; i < sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; + WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; + WFIFOB(fd,18+i*9) = itemtype((itemdb->search(sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + + + +void clif_buyingstore_entry(struct map_session_data* sd) +{ + uint8 buf[86]; + + do { if (((void)(sd), +# 16689 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16689 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x814; + WBUFL(buf,2) = sd->bl.id; + memcpy(WBUFP(buf,6), sd->message, (79 + 1)); + + clif->send(buf, packet_db[0x814].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16700 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16700 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x814].len); + WFIFOW(fd,0) = 0x814; + WFIFOL(fd,2) = pl_sd->bl.id; + memcpy(WFIFOP(fd,6), pl_sd->message, (79 + 1)); + WFIFOSET(fd,packet_db[0x814].len); +} + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { + buyingstore->close(sd); +} + + + +void clif_buyingstore_disappear_entry(struct map_session_data* sd) +{ + uint8 buf[6]; + + do { if (((void)(sd), +# 16722 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16722 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x816; + WBUFL(buf,2) = sd->bl.id; + + clif->send(buf, packet_db[0x816].len, &sd->bl, AREA_WOS); +} +void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + + do { if (((void)(sd), +# 16732 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16732 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16733 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16733 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x816].len); + WFIFOW(fd,0) = 0x816; + WFIFOL(fd,2) = pl_sd->bl.id; + WFIFOSET(fd,packet_db[0x816].len); +} + + + +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +{ + int account_id; + + account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); + + buyingstore->open(sd, account_id); +} + + + +void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + int fd; + unsigned int i; + + do { if (((void)(sd), +# 16759 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16759 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(pl_sd), +# 16760 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16760 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); + WFIFOW(fd,0) = 0x818; + WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; + WFIFOL(fd,4) = pl_sd->bl.id; + WFIFOL(fd,8) = pl_sd->buyer_id; + WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; + + for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + { + WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; + WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; + WFIFOB(fd,22+i*9) = itemtype((itemdb->search(pl_sd->buyingstore.items[i].nameid)->type)); + WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 6; + const uint8 *itemlist; + int account_id; + unsigned int count, packet_len, buyer_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 12 ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 12U, packet_len, sd->bl.id)); + return; + } + + account_id = RFIFOL(fd,info->pos[1]); + buyer_id = RFIFOL(fd,info->pos[2]); + itemlist = RFIFOP(fd,info->pos[3]); + + + packet_len-= info->pos[3]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n"), packet_len, sd->bl.id, account_id, blocksize)); + return; + } + count = packet_len/blocksize; + + buyingstore->trade(sd, account_id, buyer_id, itemlist, count); +} + + + + + + + +void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +{ + int fd; + + do { if (((void)(sd), +# 16825 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16825 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81a].len); + WFIFOW(fd,0) = 0x81a; + WFIFOW(fd,2) = result; + WFIFOSET(fd,packet_db[0x81a].len); +} + + + +void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount) +{ + int fd; + + do { if (((void)(sd), +# 16839 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16839 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81b].len); + WFIFOW(fd,0) = 0x81b; + WFIFOW(fd,2) = nameid; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = sd->buyingstore.zenylimit; + WFIFOSET(fd,packet_db[0x81b].len); +} + + + + + + + +void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +{ + int fd; + + do { if (((void)(sd), +# 16859 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16859 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x81c].len); + WFIFOW(fd,0) = 0x81c; + WFIFOW(fd,2) = index+2; + WFIFOW(fd,4) = amount; + WFIFOL(fd,6) = price; + WFIFOSET(fd,packet_db[0x81c].len); +} +# 16876 "../../../server-code/src/map/clif.c" +void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +{ + int fd; + + do { if (((void)(sd), +# 16880 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16880 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x824].len); + WFIFOW(fd,0) = 0x824; + WFIFOW(fd,2) = result; + WFIFOW(fd,4) = nameid; + WFIFOSET(fd,packet_db[0x824].len); +} + +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +# 16902 "../../../server-code/src/map/clif.c" +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { + const unsigned int blocksize = 2; + const uint8* itemlist; + const uint8* cardlist; + unsigned char type; + unsigned int min_price, max_price, packet_len, count, item_count, card_count; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + packet_len = RFIFOW(fd,info->pos[0]); + + if( packet_len < 15 ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n"), 15U, packet_len, sd->bl.id)); + return; + } + + type = RFIFOB(fd,info->pos[1]); + max_price = RFIFOL(fd,info->pos[2]); + min_price = RFIFOL(fd,info->pos[3]); + item_count = RFIFOB(fd,info->pos[4]); + card_count = RFIFOB(fd,info->pos[5]); + itemlist = RFIFOP(fd,info->pos[6]); + cardlist = RFIFOP(fd,info->pos[6]+blocksize*item_count); + + + packet_len-= info->pos[6]; + + if( packet_len%blocksize ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Unexpected item list size %u (account_id=%d, block size=%u)\n"), packet_len, sd->bl.id, blocksize)); + return; + } + count = packet_len/blocksize; + + if( count < item_count+card_count ) + { + (showmsg->showError(("clif_parse_SearchStoreInfo: Malformed packet (expected count=%u, count=%u, account_id=%d).\n"), item_count+card_count, count, sd->bl.id)); + return; + } + + searchstore->query(sd, type, min_price, max_price, (const unsigned short*)itemlist, item_count, (const unsigned short*)cardlist, card_count); +} +# 16953 "../../../server-code/src/map/clif.c" +void clif_search_store_info_ack(struct map_session_data* sd) +{ + const unsigned int blocksize = (79 + 1)+26; + int fd; + unsigned int i, start, end; + + do { if (((void)(sd), +# 16959 "../../../server-code/src/map/clif.c" 3 4 +0 +# 16959 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + start = sd->searchstore.pages*10; + end = (((sd->searchstore.count) < (start+10)) ? (sd->searchstore.count) : (start+10)); + + WFIFOHEAD(fd,7+(end-start)*blocksize); + WFIFOW(fd,0) = 0x836; + WFIFOW(fd,2) = 7+(end-start)*blocksize; + WFIFOB(fd,4) = !sd->searchstore.pages; + WFIFOB(fd,5) = searchstore->querynext(sd); + WFIFOB(fd,6) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + for( i = start; i < end; i++ ) { + struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; + struct item it; + + WFIFOL(fd,i*blocksize+ 7) = ssitem->store_id; + WFIFOL(fd,i*blocksize+11) = ssitem->account_id; + memcpy(WFIFOP(fd,i*blocksize+15), ssitem->store_name, (79 + 1)); + WFIFOW(fd,i*blocksize+15+(79 + 1)) = ssitem->nameid; + WFIFOB(fd,i*blocksize+17+(79 + 1)) = itemtype((itemdb->search(ssitem->nameid)->type)); + WFIFOL(fd,i*blocksize+18+(79 + 1)) = ssitem->price; + WFIFOW(fd,i*blocksize+22+(79 + 1)) = ssitem->amount; + WFIFOB(fd,i*blocksize+24+(79 + 1)) = ssitem->refine; + + + memset(&it, 0, sizeof(it)); + memcpy(&it.card, &ssitem->card, sizeof(it.card)); + it.nameid = ssitem->nameid; + it.amount = ssitem->amount; + + clif->addcards(WFIFOP(fd,i*blocksize+25+(79 + 1)), &it); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} +# 17004 "../../../server-code/src/map/clif.c" +void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +{ + int fd; + + do { if (((void)(sd), +# 17008 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17008 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x837].len); + WFIFOW(fd,0) = 0x837; + WFIFOB(fd,2) = reason; + WFIFOSET(fd,packet_db[0x837].len); +} + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +{ + searchstore->next(sd); +} + + + + + + +void clif_open_search_store_info(struct map_session_data* sd) +{ + int fd; + + do { if (((void)(sd), +# 17033 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17033 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83a].len); + WFIFOW(fd,0) = 0x83a; + WFIFOW(fd,2) = sd->searchstore.effect; + + WFIFOB(fd,4) = (unsigned char)(((sd->searchstore.uses) < (((uint8) 0xFF))) ? (sd->searchstore.uses) : (((uint8) 0xFF))); + + WFIFOSET(fd,packet_db[0x83a].len); +} + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +{ + searchstore->close(sd); +} + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +{ + unsigned short nameid; + int account_id, store_id; + struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; + + account_id = RFIFOL(fd,info->pos[0]); + store_id = RFIFOL(fd,info->pos[1]); + nameid = RFIFOW(fd,info->pos[2]); + + searchstore->click(sd, account_id, store_id, nameid); +} + + + +void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +{ + int fd; + + do { if (((void)(sd), +# 17074 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17074 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x83d].len); + WFIFOW(fd,0) = 0x83d; + WFIFOW(fd,2) = x; + WFIFOW(fd,4) = y; + WFIFOSET(fd,packet_db[0x83d].len); +} + + +void clif_parse_debug(int fd,struct map_session_data *sd) { + int cmd, packet_len; + + + cmd = RFIFOW(fd,0); + + if( sd ) { + packet_len = packet_db[cmd].len; + + if( packet_len == -1 ) { + packet_len = RFIFOW(fd,2); + } + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n"), (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id)); + } else { + packet_len = (int)RFIFOREST(fd); + (showmsg->showDebug(("Packet debug of 0x%04X (length %d), session #%d\n"), (unsigned int)cmd, packet_len, fd)); + } + + ShowDump(RFIFOP(fd,0), packet_len); +} + + + + +int clif_elementalconverter_list(struct map_session_data *sd) { + int i,c,view,fd; + + do { if (((void)(sd), +# 17111 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17111 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + + fd=sd->fd; + WFIFOHEAD(fd, 270 *2+4); + WFIFOW(fd,0)=0x1ad; + + for(i=0,c=0;i<270;i++){ + if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){ + if((view = (itemdb->search(skill->dbs->produce_db[i].nameid)->view_id)) > 0) + WFIFOW(fd,c*2+ 4)= view; + else + WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid; + c++; + } + } + WFIFOW(fd,2) = c*2+4; + WFIFOSET(fd, WFIFOW(fd,2)); + if (c > 0) { + sd->menuskill_id = SA_CREATECON; + sd->menuskill_val = c; + } + + return 0; +} + + + +void clif_millenniumshield(struct block_list *bl, short shields ) { + + unsigned char buf[10]; + + do { if (((void)(bl), +# 17143 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17143 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x440; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = shields; + WBUFW(buf,8) = 0; + clif->send(buf,packet_db[0x440].len,bl,AREA); + +} + + + + + + +int clif_spellbook_list(struct map_session_data *sd) +{ + int i, c; + int fd; + + do { if (((void)(sd), +# 17162 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17162 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) + { + if( ((sd->status.inventory[i].nameid) >= ITEMID_MAGIC_BOOK_FB && (sd->status.inventory[i].nameid) <= ITEMID_MAGIC_BOOK_DL) ) + { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c++; + } + } + + if( c > 0 ) + { + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + sd->menuskill_id = WL_READING_SB; + sd->menuskill_val = c; + } + else{ + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17185)); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + } + + return 1; +} + + + + + + +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17201 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17201 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_SCARLET_POINT && (sd->status.inventory[i].nameid) <= ITEMID_LIME_GREEN_POINT) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = NC_MAGICDECOY; + sd->menuskill_val = skill_lv; + sd->sc.comet_x = x; + sd->sc.comet_y = y; + WFIFOW(fd,2) = c * 2 + 4; + WFIFOSET(fd, WFIFOW(fd,2)); + } else { + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + return 0; + } + + return 1; +} + + + + + + +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { + int i, c; + int fd; + + do { if (((void)(sd), +# 17237 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17237 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + fd = sd->fd; + WFIFOHEAD(fd, 8 * 8 + 8); + WFIFOW(fd,0) = 0x1ad; + + for( i = 0, c = 0; i < 100; i ++ ) { + if( ((sd->status.inventory[i].nameid) >= ITEMID_POISON_PARALYSIS && (sd->status.inventory[i].nameid) <= ITEMID_POISON_FATIGUE) ) { + WFIFOW(fd,c * 2 + 4) = sd->status.inventory[i].nameid; + c ++; + } + } + if( c > 0 ) { + sd->menuskill_id = GC_POISONINGWEAPON; + sd->menuskill_val = 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); + return 0; + } + + return 1; +} +int clif_autoshadowspell_list(struct map_session_data *sd) { + int fd, i, c; + do { if (((void)(sd), +# 17263 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17263 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + fd = sd->fd; + if( !fd ) return 0; + + if( sd->menuskill_id == SC_AUTOSHADOWSPELL ) + return 0; + + WFIFOHEAD(fd, 2 * 6 + 4); + WFIFOW(fd,0) = 0x442; + for( i = 0, c = 0; i < 1478; i++ ) + if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && + sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) + { + WFIFOW(fd,8+c*2) = sd->status.skill[i].id; + c++; + } + + if( c > 0 ) { + WFIFOW(fd,2) = 8 + c * 2; + WFIFOL(fd,4) = c; + WFIFOSET(fd,WFIFOW(fd,2)); + sd->menuskill_id = SC_AUTOSHADOWSPELL; + sd->menuskill_val = c; + } else { + (status->change_end_((&sd->bl),(SC_STOP),((-1)),"../../../server-code/src/map/clif.c",17287)); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + } + + return 1; +} + + + + +int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +{ + + int fd; + + do { if (((void)(sd), +# 17302 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17302 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sd->menuskill_id = skill_id; + sd->menuskill_val = skill_lv; + + if( skill_id == GN_CHANGEMATERIAL ) + skill_lv = 0; + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x7e3].len); + WFIFOW(fd,0) = 0x7e3; + WFIFOL(fd,2) = skill_lv; + WFIFOL(fd,4) = 0; + WFIFOSET(fd,packet_db[0x7e3].len); + + + + return 1; + +} + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + +void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { + + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) + return; + + if( ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) ) { + clif->skill_fail(sd,sd->ud.skill_id,0,0); + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); + return; + } + + skill->select_menu(sd,RFIFOW(fd,6)); + + ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0); +} + + + + +void clif_charm(struct map_session_data *sd) +{ + unsigned char buf[10]; + + do { if (((void)(sd), +# 17351 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17351 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WBUFW(buf,0) = 0x08cf; + WBUFL(buf,2) = sd->bl.id; + WBUFW(buf,6) = sd->charm_type; + WBUFW(buf,8) = sd->charm_count; + clif->send(buf,packet_db[0x08cf].len,&sd->bl,AREA); +} + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + + + + + +void clif_parse_MoveItem(int fd, struct map_session_data *sd) { + + int index; + + + if(( (sd)->state.dead_sit == 1 )) { + return; + } + + index = RFIFOW(fd,2)-2; + + if (index < 0 || index >= 100) + return; + + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) + sd->status.inventory[index].favorite = 0; + else if( RFIFOB(fd, 4) == 0 ) + sd->status.inventory[index].favorite = 1; + else + return; + + clif->favorite_item(sd, index); + +} + + +void clif_cashshop_db(void) { + struct config_t cashshop_conf; + struct config_setting_t *cashshop = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + , *cats = +# 17396 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17396 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/cashshop_db.conf"; + int i, item_count_t = 0; + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->calloc(((1)),(sizeof(struct hCSData *)),"../../../server-code/src/map/clif.c", 17400, __func__))); + clif->cs.item_count[i] = 0; + } + + if (!libconfig->load_file(&cashshop_conf, config_filename)) + return; + + cashshop = libconfig->lookup(&cashshop_conf, "cash_shop"); + + if( cashshop != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + && (cats = libconfig->setting_get_elem(cashshop, 0)) != +# 17409 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17409 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + struct config_setting_t *cat; + char entry_name[10]; + + sprintf(entry_name,"cat_%d",i); + + if( (cat = libconfig->setting_get_member(cats, entry_name)) != +# 17416 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17416 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(cat); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(cat,k); + const char *name = ((entry)->name); + int price = libconfig->setting_get_int(entry); + struct item_data * data = +# 17423 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17423 "../../../server-code/src/map/clif.c" + ; + + if( price < 1 ) { + (showmsg->showWarning(("cashshop_db: unsupported price '%d' for entry named '%s' in category '%s'\n"), price, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("cashshop_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("cashshop_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + ((clif->cs.data[i]) = (struct hCSData * *) (iMalloc->reallocz(((clif->cs.data[i])),(sizeof(struct hCSData *) * (++clif->cs.item_count[i])),"../../../server-code/src/map/clif.c", 17442, __func__))); + ((clif->cs.data[i][ clif->cs.item_count[i] - 1 ]) = (struct hCSData *) (iMalloc->calloc(((1)),(sizeof(struct hCSData)),"../../../server-code/src/map/clif.c", 17443, __func__))); + + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->id = data->nameid; + clif->cs.data[i][ clif->cs.item_count[i] - 1 ]->price = price; + item_count_t++; + } + } + } + + } + libconfig->destroy(&cashshop_conf); + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); +} + + +void clif_favorite_item(struct map_session_data* sd, unsigned short index) { + int fd; + + do { if (((void)(sd), +# 17461 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17461 "../../../server-code/src/map/clif.c" +)) return; } while(0); + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0x908].len); + WFIFOW(fd,0) = 0x908; + WFIFOW(fd,2) = index+2; + WFIFOB(fd,4) = (sd->status.inventory[index].favorite == 1) ? 0 : 1; + WFIFOSET(fd,packet_db[0x908].len); +} + +void clif_snap( struct block_list *bl, short x, short y ) { + unsigned char buf[10]; + + do { if (((void)(bl), +# 17473 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17473 "../../../server-code/src/map/clif.c" +)) return; } while(0); + WBUFW(buf,0) = 0x8d2; + WBUFL(buf,2) = bl->id; + WBUFW(buf,6) = x; + WBUFW(buf,8) = y; + + clif->send(buf,packet_db[0x8d2].len,bl,AREA); +} + +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { + struct packet_monster_hp p; + + do { if (((void)(md), +# 17485 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17485 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(sd), +# 17486 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17486 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = monsterhpType; + p.GID = md->bl.id; + p.HP = md->status.hp; + p.MaxHP = md->status.max_hp; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +} + + +void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { + return; +} + +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + WFIFOHEAD(fd, 10); + WFIFOW(fd,0) = 0x845; + WFIFOL(fd, 2) = sd->cashPoints; + WFIFOL(fd, 6) = sd->kafraPoints; + WFIFOSET(fd, 10); +} + +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { + +} + +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { + int i, j = 0; + + for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) { + if( clif->cs.item_count[i] == 0 ) + continue; + + WFIFOHEAD(fd, 8 + ( clif->cs.item_count[i] * 6 ) ); + WFIFOW(fd,0) = 0x8ca; + WFIFOW(fd,2) = 8 + ( clif->cs.item_count[i] * 6 ); + WFIFOW(fd,4) = clif->cs.item_count[i]; + WFIFOW(fd,6) = i; + + for( j = 0; j < clif->cs.item_count[i]; j++ ) { + WFIFOW(fd,8 + ( 6 * j )) = clif->cs.data[i][j]->id; + WFIFOL(fd, 10 + ( 6 * j ) ) = clif->cs.data[i][j]->price; + } + + WFIFOSET(fd, 8 + ( clif->cs.item_count[i] * 6 )); + } +} + +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { + unsigned short limit = RFIFOW(fd, 4), i, j; + unsigned int kafra_pay = RFIFOL(fd, 6); + + if (map->list[sd->bl.m].flag.nocashshop) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1489))); + return; + } + + for(i = 0; i < limit; i++) { + int qty = RFIFOL(fd, 14 + ( i * 10 )); + int id = RFIFOL(fd, 10 + ( i * 10 )); + short tab = RFIFOW(fd, 18 + ( i * 10 )); + enum CASH_SHOP_BUY_RESULT result = CSBR_UNKNOWN; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX ) + continue; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + if( clif->cs.data[tab][j]->id == id ) + break; + } + if( j < clif->cs.item_count[tab] ) { + struct item_data *data; + if( sd->kafraPoints < kafra_pay ) { + result = CSBR_SHORTTAGE_CASH; + } else if( (sd->cashPoints+kafra_pay) < (clif->cs.data[tab][j]->price * qty) ) { + result = CSBR_SHORTTAGE_CASH; + } else if ( !( data = itemdb->exists(clif->cs.data[tab][j]->id) ) ) { + result = CSBR_UNKONWN_ITEM; + } else { + struct item item_tmp; + int k, get_count; + + get_count = qty; + + if (!itemdb->isstackable2(data)) + get_count = 1; + + pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay); + for (k = 0; k < qty; k += get_count) { + if (!pet->create_egg(sd, data->nameid)) { + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = data->nameid; + item_tmp.identify = 1; + + switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + case 0: + result = CSBR_SUCCESS; + break; + case 1: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 2: + result = CSBR_INVENTORY_WEIGHT; + break; + case 4: + result = CSBR_INVENTORY_ITEMCNT; + break; + case 5: + result = CSBR_EACHITEM_OVERCOUNT; + break; + case 7: + result = CSBR_RUNE_OVERCOUNT; + break; + } + + if( result != CSBR_SUCCESS ) + pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + } else + result = CSBR_SUCCESS; + } + } + } else { + result = CSBR_UNKONWN_ITEM; + } + + WFIFOHEAD(fd, 16); + WFIFOW(fd,0) = 0x849; + WFIFOL(fd, 2) = id; + WFIFOW(fd,6) = result; + WFIFOL(fd, 8) = sd->cashPoints; + WFIFOL(fd, 12) = sd->kafraPoints; + WFIFOSET(fd, 16); + + } +} + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { + short tab = RFIFOW(fd, 2); + int j; + + if( tab < 0 || tab >= CASHSHOP_TAB_MAX || clif->cs.item_count[tab] == 0 ) + return; + + WFIFOHEAD(fd, 10 + ( clif->cs.item_count[tab] * 6 ) ); + WFIFOW(fd,0) = 0x8c0; + WFIFOW(fd,2) = 10 + ( clif->cs.item_count[tab] * 6 ); + WFIFOL(fd, 4) = tab; + WFIFOW(fd,8) = clif->cs.item_count[tab]; + + for( j = 0; j < clif->cs.item_count[tab]; j++ ) { + WFIFOW(fd,10 + ( 6 * j )) = clif->cs.data[tab][j]->id; + WFIFOL(fd, 12 + ( 6 * j ) ) = clif->cs.data[tab][j]->price; + } + + WFIFOSET(fd, 10 + ( clif->cs.item_count[tab] * 6 )); +} + +void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { + + struct packet_maptypeproperty2 p; + struct map_session_data *sd = +# 17658 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17658 "../../../server-code/src/map/clif.c" + ; + do { if (((void)(bl), +# 17659 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17659 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + sd = ( ((bl) == (struct block_list *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + || (bl)->type != (BL_PC)) ? (TBL_PC *) +# 17661 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17661 "../../../server-code/src/map/clif.c" + : (TBL_PC *)(bl) ); + + p.PacketType = maptypeproperty2Type; + p.type = 0x28; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.guild = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle))) ? 1 : 0; + p.flag.siege = (map->list[bl->m].flag.battleground || (map->list[bl->m].flag.gvg || map->list[bl->m].flag.gvg_castle)) ? 1: 0; + p.flag.mineffect = (map->list[bl->m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[bl->m].flag.gvg_castle)) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); + p.flag.nolockon = 0; + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; + p.flag.nocostume = (map->list[bl->m].flag.noviewid & (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)) ? 1 : 0; + p.flag.usecart = 1; + p.flag.summonstarmiracle = 0; + p.flag.SpareBits = 0; + + clif->send(&p,sizeof(p),bl,t); + +} + +void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { + struct packet_status_change2 p; + + p.PacketType = status_change2Type; + p.index = type; + p.AID = tid; + p.state = 1; + p.Left = 9999; + p.val1 = val1; + p.val2 = val2; + p.val3 = val3; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_partytickack(struct map_session_data* sd, +# 17697 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 17697 "../../../server-code/src/map/clif.c" + flag) { + do { if (((void)(sd), +# 17698 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17698 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(sd->fd, packet_db[0x2c9].len); + WFIFOW(sd->fd,0) = 0x2c9; + WFIFOB(sd->fd, 2) = flag; + WFIFOSET(sd->fd, packet_db[0x2c9].len); +} + +void clif_ShowScript(struct block_list* bl, const char* message) { + char buf[256]; + size_t len; + do { if (((void)(bl), +# 17709 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17709 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if(!message) + return; + + len = strlen(message)+1; + + if (len > sizeof(buf)-8) { + (showmsg->showWarning(("clif_ShowScript: Truncating too long message '%s' (len=%""z" "u"").\n"), message, len)); + len = sizeof(buf)-8; + } + + WBUFW(buf,0)=0x8b3; + WBUFW(buf,2)=len+8; + WBUFL(buf,4)=bl->id; + (strlib->safestrncpy_((WBUFP(buf,8)),(message),(len))); + clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT); +} + +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + do { if (((void)(bl), +# 17731 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17731 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if (bl->type == BL_PC && !((TBL_PC *)BL_UCAST_(bl))->state.active) + return; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + +void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { + switch (response) { + case BGQA_FAIL_COOLDOWN: + case BGQA_FAIL_DESERTER: + case BGQA_FAIL_TEAM_COUNT: + break; + default: { + struct packet_bgqueue_ack p; + + do { if (((void)(sd), +# 17753 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17753 "../../../server-code/src/map/clif.c" + )) return; } while(0); + p.PacketType = bgqueue_ackType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); + } + break; + } +} + +void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +{ + struct packet_bgqueue_notice_delete p; + + do { if (((void)(sd), +# 17768 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17768 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notice_deleteType; + p.type = response; + (strlib->safestrncpy_((p.bg_name),(name),(sizeof(p.bg_name)))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_register *p = RP2PTR(fd); + struct bg_arena *arena = +# 17780 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 17780 "../../../server-code/src/map/clif.c" + ; + if( !bg->queue_on ) return; + + if( !(arena = bg->name2arena(p->bg_name)) ) { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0); + return; + } + + switch( (enum bg_queue_types)p->type ) { + case BGQT_INDIVIDUAL: + case BGQT_PARTY: + case BGQT_GUILD: + break; + default: + clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); + return; + } + + bg->queue_add(sd, arena, (enum bg_queue_types)p->type); +} + +void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { + struct packet_bgqueue_update_info p; + + do { if (((void)(sd), +# 17804 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17804 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17805 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17805 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17805, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17805 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17805 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_updateinfoType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + p.position = position; + + sd->bg_queue.client_has_bg_data = +# 17810 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17810 "../../../server-code/src/map/clif.c" + ; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_checkstate *p = RP2PTR(fd); + + do { if (((void)(sd), +# 17820 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17820 "../../../server-code/src/map/clif.c" +)) return; } while(0); + if (sd->bg_queue.arena && sd->bg_queue.type) { + clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); + } else { + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); + } +} + +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); + + if( sd->bg_queue.arena ) + bg->queue_pc_cleanup(sd); + else + clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); +} + +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +{ + const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); + struct bg_arena *arena; + + if( !bg->queue_on ) return; + + if( ( arena = bg->name2arena(p->bg_name) ) ) { + bg->queue_ready_ack(arena,sd, ( p->result == 1 ) ? +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 17848 "../../../server-code/src/map/clif.c" + : +# 17848 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 17848 "../../../server-code/src/map/clif.c" + ); + } else { + clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID, 0); + } +} + +void clif_bgqueue_joined(struct map_session_data *sd, int pos) { + struct packet_bgqueue_notify_entry p; + + do { if (((void)(sd), +# 17857 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17857 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = bgqueue_notify_entryType; + (strlib->safestrncpy_((p.name),(sd->status.name),(sizeof(p.name)))); + p.position = pos; + + clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); +} + +void clif_bgqueue_pcleft(struct map_session_data *sd) { + + return; +} + + +void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { + struct packet_bgqueue_battlebegins p; + + do { if (((void)(sd), +# 17874 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17874 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (( (arena_id < bg->arenas) ? +# 17875 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17875 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 17875, __func__, "arena_id < bg->arenas", "failed assertion"), +# 17875 "../../../server-code/src/map/clif.c" 3 4 +1 +# 17875 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + p.PacketType = bgqueue_battlebeginsType; + (strlib->safestrncpy_((p.bg_name),(bg->arena[arena_id]->name),(sizeof(p.bg_name)))); + (strlib->safestrncpy_((p.game_name),(bg->arena[arena_id]->name),(sizeof(p.game_name)))); + + clif->send(&p,sizeof(p), &sd->bl, target); +} + +void clif_scriptclear(struct map_session_data *sd, int npcid) { + struct packet_script_clear p; + + do { if (((void)(sd), +# 17886 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17886 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = script_clearType; + p.NpcID = npcid; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { + struct packet_package_item_announce p; + + do { if (((void)(sd), +# 17897 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17897 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = package_item_announceType; + p.PacketLength = 11+(23 + 1); + p.type = 0x0; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.unknown = 0x2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { + struct packet_item_drop_announce p; + + do { if (((void)(sd), +# 17914 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17914 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = item_drop_announceType; + p.PacketLength = sizeof(p); + p.type = 0x1; + p.ItemID = nameid; + p.len = (23 + 1); + (strlib->safestrncpy_((p.Name),(sd->status.name),(sizeof(p.Name)))); + p.monsterNameLen = (23 + 1); + (strlib->safestrncpy_((p.monsterName),(monsterName),(sizeof(p.monsterName)))); + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); +} + + +void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { + + const int offset = 10; + + + + int i, count = 0; + + do { if (((void)(cd), +# 17936 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17936 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + WFIFOHEAD(fd,4+(offset*cd->cursor)); + + + WFIFOW(fd,0) = 0x985; + + + + + for( i = 0; i < cd->cursor; i++ ) { + if( cd->entry[i]->duration < 1 ) continue; + + WFIFOW(fd,4 + (count*offset)) = cd->entry[i]->skill_id; + + WFIFOL(fd, 6 + (count*offset)) = cd->entry[i]->total; + WFIFOL(fd, 10 + (count*offset)) = cd->entry[i]->duration; + + + + count++; + } + + WFIFOW(fd,2) = 4+(offset*count); + + WFIFOSET(fd,4+(offset*count)); +} + + + + + +void clif_cart_additem_ack(struct map_session_data *sd, int flag) { + struct packet_cart_additem_ack p; + + do { if (((void)(sd), +# 17971 "../../../server-code/src/map/clif.c" 3 4 +0 +# 17971 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = cart_additem_ackType; + p.result = (char)flag; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +{ + const struct packet_banking_deposit_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_deposit(sd,money); +} + +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +{ + const struct packet_banking_withdraw_req *p = RP2PTR(fd); + int money; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + money = (int)(((p->Money) >= (0x7fffffff)) ? (0x7fffffff) : ((p->Money) <= (0)) ? (0) : (p->Money)); + + pc->bank_withdraw(sd,money); +} + +void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankCheck(int fd, struct map_session_data* sd) { + struct packet_banking_check p; + + if (!battle_config.feature_banking) { + clif->messagecolor_self(fd, 0xff0000U, atcommand->msgfd((fd),(1483))); + return; + } + + p.PacketType = banking_checkType; + p.Money = (int)sd->status.bank_vault; + p.Reason = (short)0; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankOpen(int fd, struct map_session_data* sd) { + return; +} + +void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_BankClose(int fd, struct map_session_data* sd) { + return; +} + +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { + struct packet_banking_deposit_ack p; + + do { if (((void)(sd), +# 18040 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18040 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_deposit_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { + struct packet_banking_withdraw_ack p; + + do { if (((void)(sd), +# 18052 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18052 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = banking_withdraw_ackType; + p.Balance = sd->status.zeny; + p.Money = (int64)sd->status.bank_vault; + p.Reason = (short)reason; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + +void clif_show_modifiers (struct map_session_data *sd) { + do { if (((void)(sd), +# 18064 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18064 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { + char output[128]; + + snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%", + sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death); + clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF); + } + +} + +void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { + struct packet_notify_bounditem p; + + do { if (((void)(sd), +# 18079 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18079 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = notify_bounditemType; + p.index = index+2; + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + + + +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + + if( !tsd || ( (tsd)->group->level ) >= ( (sd)->group->level ) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem(tsd, tsd->equip_index[i], PCUNEQUIPITEM_FORCE); + } +} + + + + +int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { + struct cdelayed_damage *dd = (struct cdelayed_damage *)data; + + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + + return 0; +} +# 18131 "../../../server-code/src/map/clif.c" +int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { + struct cdelayed_damage *dd; + struct status_change *sc; + + + + int damage; + + + do { if (((void)(src), +# 18140 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18140 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(dst), +# 18141 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18141 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + + sc = status->get_sc(dst); + + if(sc && sc->count && sc->data[SC_ILLUSION]) { + if(in_damage) in_damage = in_damage*(sc->data[SC_ILLUSION]->val2) + rnd()%100; + } + + + + + damage = (int)(((in_damage) < (0x7fffffff)) ? (in_damage) : (0x7fffffff)); + + + type = clif_calc_delay(type,div,damage,ddelay); + + dd = ((struct cdelayed_damage *)(clif->delayed_damage_ers)->alloc(clif->delayed_damage_ers)); + + dd->p.PacketType = damageType; + dd->p.GID = src->id; + dd->p.targetGID = dst->id; + dd->p.startTime = (uint32)timer->gettick(); + dd->p.attackMT = sdelay; + dd->p.attackedMT = ddelay; + dd->p.count = div; + dd->p.action = type; + dd->p.leftDamage = 0; + + if( battle_config.hide_woe_damage && (map->list[src->m].flag.gvg || map->list[src->m].flag.gvg_castle) ) + dd->p.damage = damage?div:0; + else + dd->p.damage = damage; + + dd->bl.m = dst->m; + dd->bl.x = dst->x; + dd->bl.y = dst->y; + dd->bl.type = BL_NUL; + + if( tick > timer->gettick() ) + timer->add(tick,clif->delay_damage_sub,0,(intptr_t)dd); + else { + clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); + + ((clif->delayed_damage_ers)->free((clif->delayed_damage_ers),(dd))); + } + + return clif->calc_walkdelay(dst,ddelay,type,damage,div); +} + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); + +void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + + +void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { + + struct npc_item_list *shop; + unsigned short shop_size, i, c; + + do { if (((void)(sd), +# 18203 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18203 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(nd), +# 18204 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18204 "../../../server-code/src/map/clif.c" +)) return; } while(0); + shop = nd->u.scr.shop->item; + shop_size = nd->u.scr.shop->items; + npcmarket_open.PacketType = npcmarketopenType; + + for(i = 0, c = 0; i < shop_size; i++) { + struct item_data *id = +# 18210 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18210 "../../../server-code/src/map/clif.c" + ; + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != +# 18211 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18211 "../../../server-code/src/map/clif.c" + ) { + npcmarket_open.list[c].nameid = shop[i].nameid; + npcmarket_open.list[c].price = shop[i].value; + npcmarket_open.list[c].qty = shop[i].qty; + npcmarket_open.list[c].type = itemtype(id->type); + npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + c++; + } + } + + npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); + + clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { + + sd->npc_shopid = 0; +} + +void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +{ + + unsigned short c = 0; + + do { if (((void)(sd), +# 18238 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18238 "../../../server-code/src/map/clif.c" +)) return; } while(0); + do { if (((void)(item_list), +# 18239 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18239 "../../../server-code/src/map/clif.c" +)) return; } while(0); + npcmarket_result.PacketType = npcmarketresultackType; + npcmarket_result.result = response == 0 ? 1 : 0; + + if (npcmarket_result.result) { + struct npc_data *nd = map->id2nd(sd->npc_shopid); + struct npc_item_list *shop = nd->u.scr.shop->item; + unsigned short shop_size = nd->u.scr.shop->items; + int i; + + for (i = 0; i < ( (*item_list)._len_ ); i++) { + const struct itemlist_entry *entry = &( ( (*item_list)._data_ )[i] ); + int j; + + npcmarket_result.list[i].ITID = entry->id; + npcmarket_result.list[i].qty = entry->amount; + + do { for ((j) = (0); (j) < (shop_size); ++(j)) if (entry->id == shop[j].nameid) break; } while( +# 18256 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18256 "../../../server-code/src/map/clif.c" + ); + + npcmarket_result.list[i].price = (j != shop_size) ? shop[j].value : 0; + + c++; + } + } + + npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; + + clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); + +} + +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +{ + + const struct packet_npc_market_purchase *p = RP2PTR(fd); + int response = 0, i; + int count = (p->PacketLength - 4) / sizeof p->list[0]; + struct itemlist item_list; + + do { if (( (count >= 0 && count <= 100) ? +# 18279 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18279 "../../../server-code/src/map/clif.c" +: (nullpo->assert_report("../../../server-code/src/map/clif.c", 18279, __func__, "count >= 0 && count <= 100", "failed assertion"), +# 18279 "../../../server-code/src/map/clif.c" 3 4 +1 +# 18279 "../../../server-code/src/map/clif.c" +) )) return; } while(0); + + memset(&(item_list), 0, sizeof(item_list)); + do { int _empty_ = ( (item_list)._max_ )-( (item_list)._len_ ); if ((count) > _empty_) { while ((count) > _empty_) _empty_ += (1); do { if ((_empty_+( (item_list)._len_ )) > ( (item_list)._max_ )) { if (( (item_list)._max_ ) == 0) ( (item_list)._data_ ) = (iMalloc->malloc(((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); else ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); memset(( (item_list)._data_ )+( (item_list)._len_ ), 0, (( (item_list)._max_ )-( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); } else if ((_empty_+( (item_list)._len_ )) == 0 && ( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._data_ ) = +# 18282 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18282 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } else if ((_empty_+( (item_list)._len_ )) < ( (item_list)._max_ )) { ( (item_list)._data_ ) = (iMalloc->realloc((( (item_list)._data_ )),((_empty_+( (item_list)._len_ ))*sizeof(( ( ( (item_list)._data_ )[0] ) ))),"../../../server-code/src/map/clif.c", 18282, __func__)); ( (item_list)._max_ ) = (_empty_+( (item_list)._len_ )); if ((_empty_+( (item_list)._len_ )) - ( (item_list)._len_ ) > 0) ( (item_list)._len_ ) = (_empty_+( (item_list)._len_ )); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); } } while( +# 18282 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18282 "../../../server-code/src/map/clif.c" +); + + for (i = 0; i < count; i++) { + struct itemlist_entry entry = { 0 }; + + entry.id = p->list[i].ITID; + entry.amount = p->list[i].qty; + + do { ( ( (item_list)._data_ )[( (item_list)._len_ )] ) = (entry); ++( (item_list)._len_ ); }while( +# 18290 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18290 "../../../server-code/src/map/clif.c" + ); + } + + response = npc->market_buylist(sd, &item_list); + clif->npc_market_purchase_ack(sd, &item_list, response); + + do { if (( (item_list)._max_ ) > 0) { (iMalloc->free((( (item_list)._data_ )),"../../../server-code/src/map/clif.c", 18296, __func__)); ( (item_list)._data_ ) = +# 18296 "../../../server-code/src/map/clif.c" 3 4 +((void *)0) +# 18296 "../../../server-code/src/map/clif.c" +; ( (item_list)._max_ ) = 0; ( (item_list)._len_ ) = 0; } } while( +# 18296 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18296 "../../../server-code/src/map/clif.c" +); + +} + +void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { + struct packet_party_leader_changed p; + + do { if (((void)(sd), +# 18303 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18303 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = partyleaderchangedType; + + p.prev_leader_aid = prev_leader_aid; + p.new_leader_aid = new_leader_aid; + + clif->send(&p,sizeof(p),&sd->bl,PARTY); +} + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + +void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { + struct packet_roulette_open_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = 0xa1a; + p.Result = 0; + p.Serial = 0; + p.Step = sd->roulette.stage - 1; + p.Idx = (char)sd->roulette.prizeIdx; + p.AdditionItemID = -1; + p.BronzePoint = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.GoldPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.SilverPoint = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { + struct packet_roulette_info_ack p; + unsigned short i, j, count = 0; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = rouletteinfoackType; + p.PacketLength = 8 + (42 * 8); + p.RouletteSerial = 1; + + for(i = 0; i < 7; i++) { + for(j = 0; j < 9 -i; j++) { + p.ItemInfo[count].Row = i; + p.ItemInfo[count].Position = j; + p.ItemInfo[count].ItemId = clif->rd.nameid[i][j]; + p.ItemInfo[count].Count = clif->rd.qty[i][j]; + count++; + } + } + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + + + + return; +} + +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { + unsigned char result = GENERATE_ROULETTE_SUCCESS; + short stage = sd->roulette.stage; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + if( sd->roulette.stage >= 7 ) + stage = sd->roulette.stage = 0; + + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) <= 0 && + (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) < 10 && + (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) < 10 ) + result = GENERATE_ROULETTE_NO_ENOUGH_POINT; + } + + if( result == GENERATE_ROULETTE_SUCCESS ) { + if( stage == 0 ) { + if( (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) > 0 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteBronze")),((pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))) - 1))); + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteSilver")),((pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))) - 10))); + stage = sd->roulette.stage = 2; + } else if( (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) > 9 ) { + (pc->setregistry((sd),(script->add_str("TmpRouletteGold")),((pc->readregistry((sd),(script->add_str("TmpRouletteGold")))) - 10))); + stage = sd->roulette.stage = 4; + } + } + sd->roulette.prizeStage = stage; + sd->roulette.prizeIdx = rnd()%clif->rd.items[stage]; + if( sd->roulette.prizeIdx == 0 ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[stage][0]; + it.identify = 1; + + pc->additem(sd, &it, clif->rd.qty[stage][0], LOG_TYPE_ROULETTE); + + sd->roulette.stage = 0; + result = GENERATE_ROULETTE_LOSING; + } else + sd->roulette.claimPrize = +# 18421 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18421 "../../../server-code/src/map/clif.c" + ; + } + + clif->roulette_generate_ack(sd,result,stage,sd->roulette.prizeIdx,0); + if( result == GENERATE_ROULETTE_SUCCESS ) + sd->roulette.stage++; +} + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); + + + +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { + struct packet_roulette_itemrecv_ack p; + + if( !battle_config.feature_roulette ) { + clif->message(fd,"Roulette is disabled"); + return; + } + + p.PacketType = roulettercvitemackType; + p.AdditionItemID = 0; + + if( sd->roulette.claimPrize ) { + struct item it; + memset(&it, 0, sizeof(it)); + + it.nameid = clif->rd.nameid[sd->roulette.prizeStage][sd->roulette.prizeIdx]; + it.identify = 1; + + switch (pc->additem(sd, &it, clif->rd.qty[sd->roulette.prizeStage][sd->roulette.prizeIdx], LOG_TYPE_ROULETTE)) { + case 0: + p.Result = RECV_ITEM_SUCCESS; + sd->roulette.claimPrize = +# 18454 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18454 "../../../server-code/src/map/clif.c" + ; + sd->roulette.prizeStage = 0; + sd->roulette.prizeIdx = 0; + sd->roulette.stage = 0; + break; + case 1: + case 4: + case 5: + p.Result = RECV_ITEM_OVERCOUNT; + break; + case 2: + p.Result = RECV_ITEM_OVERWEIGHT; + break; + default: + case 7: + p.Result = RECV_ITEM_FAILED; + break; + } + } else + p.Result = RECV_ITEM_FAILED; + + clif->send(&p,sizeof(p), &sd->bl, SELF); + return; +} + + +# 18479 "../../../server-code/src/map/clif.c" 3 4 +_Bool +# 18479 "../../../server-code/src/map/clif.c" + clif_parse_roulette_db(void) { + struct config_t roulette_conf; + struct config_setting_t *roulette = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + , *levels = +# 18481 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18481 "../../../server-code/src/map/clif.c" + ; + const char *config_filename = "db/roulette_db.conf"; + int i, j, item_count_t = 0; + + for( i = 0; i < 7; i++ ) { + clif->rd.items[i] = 0; + } + + if (!libconfig->load_file(&roulette_conf, config_filename)) + return +# 18490 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 18490 "../../../server-code/src/map/clif.c" + ; + roulette = libconfig->lookup(&roulette_conf, "roulette"); + + if( roulette != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + && (levels = libconfig->setting_get_elem(roulette, 0)) != +# 18493 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18493 "../../../server-code/src/map/clif.c" + ) { + for(i = 0; i < 7; i++) { + struct config_setting_t *level; + char entry_name[10]; + + sprintf(entry_name,"level_%d",i+1); + + if( (level = libconfig->setting_get_member(levels, entry_name)) != +# 18500 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18500 "../../../server-code/src/map/clif.c" + ) { + int k, item_count = libconfig->setting_length(level); + + for(k = 0; k < item_count; k++) { + struct config_setting_t *entry = libconfig->setting_get_elem(level,k); + const char *name = ((entry)->name); + int qty = libconfig->setting_get_int(entry); + struct item_data * data = +# 18507 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18507 "../../../server-code/src/map/clif.c" + ; + + if( qty < 1 ) { + (showmsg->showWarning(("roulette_db: unsupported qty '%d' for entry named '%s' in category '%s'\n"), qty, name, entry_name)); + continue; + } + + if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if( !( data = itemdb->exists(atoi(name+2))) ) { + (showmsg->showWarning(("roulette_db: unknown item id '%s' in category '%s'\n"), name+2, entry_name)); + continue; + } + } else { + if( !( data = itemdb->search_name(name) ) ) { + (showmsg->showWarning(("roulette_db: unknown item name '%s' in category '%s'\n"), name, entry_name)); + continue; + } + } + + j = clif->rd.items[i]; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (++clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18527, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18528, __func__))); + + clif->rd.nameid[i][j] = data->nameid; + clif->rd.qty[i][j] = qty; + + item_count_t++; + } + } + } + } + libconfig->destroy(&roulette_conf); + + for(i = 0; i < 7; i++) { + int limit = 9 -i; + if( clif->rd.items[i] == limit ) continue; + + if( clif->rd.items[i] > limit ) { + (showmsg->showWarning(("roulette_db: level %d has %d items, only %d supported, capping...\n"),i+1,clif->rd.items[i],limit)); + clif->rd.items[i] = limit; + continue; + } + + (showmsg->showWarning(("roulette_db: level %d has %d items, %d are required. filling with apples\n"),i+1,clif->rd.items[i],limit)); + + clif->rd.items[i] = limit; + ((clif->rd.nameid[i]) = (int *) (iMalloc->reallocz(((clif->rd.nameid[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18553, __func__))); + ((clif->rd.qty[i]) = (int *) (iMalloc->reallocz(((clif->rd.qty[i])),(sizeof(int) * (clif->rd.items[i])),"../../../server-code/src/map/clif.c", 18554, __func__))); + + for(j = 0; j < 9 -i; j++) { + if (clif->rd.qty[i][j]) + continue; + clif->rd.nameid[i][j] = ITEMID_APPLE; + clif->rd.qty[i][j] = 1; + } + } + (showmsg->showStatus(("Done reading '""\033[1;37m""%d""\033[0m""' entries in '""\033[1;37m""%s""\033[0m""'.\n"), item_count_t, config_filename)); + + return +# 18565 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 18565 "../../../server-code/src/map/clif.c" + ; +} + + + + +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { + struct packet_roulette_generate_ack p; + + do { if (((void)(sd), +# 18574 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18574 "../../../server-code/src/map/clif.c" +)) return; } while(0); + p.PacketType = roulettgenerateackType; + p.Result = result; + p.Step = stage; + p.Idx = prizeIdx; + p.AdditionItemID = bonusItemID; + p.RemainBronze = (pc->readregistry((sd),(script->add_str("TmpRouletteBronze")))); + p.RemainGold = (pc->readregistry((sd),(script->add_str("TmpRouletteGold")))); + p.RemainSilver = (pc->readregistry((sd),(script->add_str("TmpRouletteSilver")))); + + clif->send(&p,sizeof(p), &sd->bl, SELF); +} + + + + +void clif_openmergeitem(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, j = 0; + struct merge_item merge_items[100]; + struct merge_item *merge_items_[100] = {0}; + + do { if (((void)(sd), +# 18596 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18596 "../../../server-code/src/map/clif.c" +)) return; } while(0); + memset(&merge_items,'\0',sizeof(merge_items)); + + for (i = 0; i < 100; i++) { + struct item *item_data = &sd->status.inventory[i]; + + if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) + continue; + + merge_items[n].nameid = item_data->nameid; + merge_items[n].position = i + 2; + n++; + } + + qsort(merge_items,n,sizeof(struct merge_item),clif->comparemergeitem); + + for (i = 0, j = 0; i < n; i++) { + if (i > 0 && merge_items[i].nameid == merge_items[i-1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + + if (i < n - 1 && merge_items[i].nameid == merge_items[i+1].nameid) + { + merge_items_[j] = &merge_items[i]; + j++; + continue; + } + } + + WFIFOHEAD(fd,2*j+4); + WFIFOW(fd,0) = 0x96d; + WFIFOW(fd,2) = 2*j+4; + for ( i = 0; i < j; i++ ) + WFIFOW(fd,i*2+4) = merge_items_[i]->position; + WFIFOSET(fd,2*j+4); +} + +int clif_comparemergeitem(const void *a, const void *b) +{ + const struct merge_item *a_ = a; + const struct merge_item *b_ = b; + + do { if (((void)(a), +# 18641 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18641 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + do { if (((void)(b), +# 18642 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18642 "../../../server-code/src/map/clif.c" +)) return(0); } while(0); + if (a_->nameid == b_->nameid) + return 0; + return a_->nameid > b_->nameid ? -1 : 1; +} + +void clif_ackmergeitems(int fd, struct map_session_data *sd) +{ + int i = 0, n = 0, length = 0, count = 0; + int16 nameid = 0, indexes[100] = {0}, amounts[100] = {0}; + struct item item_data; + + do { if (((void)(sd), +# 18654 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18654 "../../../server-code/src/map/clif.c" +)) return; } while(0); + length = (RFIFOW(fd,2) - 4)/2; + + if (length >= 100 || length < 2) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0, n = 0; i < length; i++) { + int16 idx = RFIFOW(fd,i*2+4) - 2; + struct item *it = +# 18669 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18669 "../../../server-code/src/map/clif.c" + ; + + if (idx < 0 || idx >= 100) + continue; + + it = &sd->status.inventory[idx]; + + if (it->nameid == 0 || !itemdb->isstackable(it->nameid) || it->bound != IBT_NONE) + continue; + + if (nameid == 0) + nameid = it->nameid; + + if (nameid != it->nameid) + continue; + + count += it->amount; + indexes[n] = idx; + amounts[n] = it->amount; + n++; + } + + if (n < 2 || count == 0) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_FAILD; + WFIFOSET(fd,7); + return; + } + + if (count > 30000) { + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = 0; + WFIFOW(fd,4) = 0; + WFIFOB(fd,6) = MERGEITEM_MAXCOUNTFAILD; + WFIFOSET(fd,7); + return; + } + + for (i = 0; i < n; i++) + pc->delitem(sd,indexes[i],amounts[i],0,DELITEM_NORMAL,LOG_TYPE_NPC); + + memset(&item_data,'\0',sizeof(item_data)); + + item_data.nameid = nameid; + item_data.identify = 1; + item_data.unique_id = itemdb->unique_id(sd); + pc->additem(sd,&item_data,count,LOG_TYPE_NPC); + + do { for ((i) = (0); (i) < (100); ++(i)) if (item_data.unique_id == sd->status.inventory[i].unique_id) break; } while( +# 18721 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18721 "../../../server-code/src/map/clif.c" +); + + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x96f; + WFIFOW(fd,2) = i+2; + WFIFOW(fd,4) = count; + WFIFOB(fd,6) = MERGEITEM_SUCCESS; + WFIFOSET(fd,7); +} + +void clif_cancelmergeitem (int fd, struct map_session_data *sd) +{ + + return; +} + +void clif_dressroom_open(struct map_session_data *sd, int view) +{ + int fd; + + do { if (((void)(sd), +# 18741 "../../../server-code/src/map/clif.c" 3 4 +0 +# 18741 "../../../server-code/src/map/clif.c" +)) return; } while(0); + + fd = sd->fd; + WFIFOHEAD(fd,packet_db[0xa02].len); + WFIFOW(fd,0)=0xa02; + WFIFOW(fd,2)=view; + WFIFOSET(fd,packet_db[0xa02].len); +} + + + +void clif_selectcart(struct map_session_data *sd) +{ + + int i = 0, fd; + + fd = sd->fd; + + WFIFOHEAD(fd, 8 + 3); + WFIFOW(fd,0) = 0x97f; + WFIFOW(fd,2) = 8 + 3; + WFIFOL(fd, 4) = sd->status.account_id; + + for (i = 0; i < 3; i++) { + WFIFOB(fd, 8 + i) = 9 + 1 + i; + } + + WFIFOSET(fd, 8 + 3); + +} + + + + + + + +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == +# 18782 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18782 "../../../server-code/src/map/clif.c" + ) + return "Unknown"; + + return name; +} + + +unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { + if( sd ) { + return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); + } + return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); +} + +unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + return cmd; +} + +unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + cmd = clif->decrypt_cmd(cmd, sd); + + return cmd; +} + +unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { + unsigned short cmd = RFIFOW(fd,0); + + + if( cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0 ) { + if( sd ) + sd->parse_cmd_func = clif_parse_cmd_decrypt; + return clif_parse_cmd_decrypt(fd, sd); + } else if( sd ) { + sd->parse_cmd_func = clif_parse_cmd_normal; + } + + return cmd; +} + + + + +int clif_parse(int fd) { + int cmd, packet_len; + struct map_session_data *sd; + int pnum; + + + + + for( pnum = 0; pnum < 3; ++pnum ) { + unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); + + + sd = sockt->session[fd]->session_data; + + if (sockt->session[fd]->flag.eof) { + if (sd) { + if (sd->state.autotrade) { + + sockt->session[fd]->session_data = +# 18846 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18846 "../../../server-code/src/map/clif.c" + ; + sd->fd = 0; + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off (using @autotrade).\n"), sd->status.name)); + } else + if (sd->state.active) { + + (showmsg->showInfo(("Character '""\033[1;37m""%s""\033[0m""' logged off.\n"), sd->status.name)); + clif->quitsave(fd, sd); + } else { + + (showmsg->showInfo(("Player AID:%d/CID:%d logged off.\n"), sd->status.account_id, sd->status.char_id)); + map->quit(sd); + } + } else { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), sockt->ip2str(sockt->session[fd]->client_addr, +# 18860 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18860 "../../../server-code/src/map/clif.c" + ))); + } + sockt->close(fd); + return 0; + } + + if (RFIFOREST(fd) < 2) + return 0; + + if (sd) + parse_cmd_func = sd->parse_cmd_func; + else + parse_cmd_func = clif->parse_cmd; + + cmd = parse_cmd_func(fd,sd); + + if (( (HPM->packets[hpClif_Parse])._len_ ) > 0) { + int result = HPM->parse_packets(fd,cmd,hpClif_Parse); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + + if (cmd > 0x0F00 || cmd < 0x0064 || packet_db[cmd].len == 0) { + (showmsg->showWarning(("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %""z" "u"" bytes received), disconnecting session #%d.\n"), (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd)) + ; + + + + sockt->eof(fd); + return 0; + } + + + if ( ( packet_len = packet_db[cmd].len ) == -1) { + + if (RFIFOREST(fd) < 4) + return 0; + + packet_len = RFIFOW(fd,2); + if (packet_len < 4 || packet_len > 32768) { + (showmsg->showWarning(("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n"), (unsigned int)cmd, packet_len, fd)); + + + + sockt->eof(fd); + + return 0; + } + } + + if ((int)RFIFOREST(fd) < packet_len) + return 0; + + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + + + int16 *packet_id = ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (0))); + + *packet_id = cmd; + if( sd ) { + sd->cryptKey = (( sd->cryptKey * clif->cryptKey[1] ) + clif->cryptKey[2]) & 0xFFFFFFFF; + } + } + + if( packet_db[cmd].func == clif->pDebug ) + packet_db[cmd].func(fd, sd); + else if( packet_db[cmd].func != +# 18929 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18929 "../../../server-code/src/map/clif.c" + ) { + if( !sd && packet_db[cmd].func != clif->pWantToConnection ) + ; + else + if( sd && sd->bl.prev == +# 18933 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18933 "../../../server-code/src/map/clif.c" + && packet_db[cmd].func != clif->pLoadEndAck ) + ; + else + packet_db[cmd].func(fd, sd); + } +# 18968 "../../../server-code/src/map/clif.c" + RFIFOSKIP(fd, packet_len); + + }; + + return 0; +} + + + + + + + +const struct s_packet_db *clif_packet(int packet_id) +{ + if (packet_id < 0x0064 || packet_id > 0x0F00 || packet_db[packet_id].len == 0) + return +# 18984 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 18984 "../../../server-code/src/map/clif.c" + ; + return &packet_db[packet_id]; +} + +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { + va_list va; + int i; + int pos; + pFunc func; + + if (cmd > 0x0F00) { + (showmsg->showError(("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0F00)); + return; + } + + if (cmd < 0x0064) { + (showmsg->showError(("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n"), (unsigned int)cmd, (unsigned int)0x0064)); + return; + } + + packet_db[cmd].len = len; + + +# 19006 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19006 "../../../server-code/src/map/clif.c" +va +# 19006 "../../../server-code/src/map/clif.c" 3 4 +, +# 19006 "../../../server-code/src/map/clif.c" +len +# 19006 "../../../server-code/src/map/clif.c" 3 4 +) +# 19006 "../../../server-code/src/map/clif.c" + ; + + pos = +# 19008 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19008 "../../../server-code/src/map/clif.c" + va +# 19008 "../../../server-code/src/map/clif.c" 3 4 + , +# 19008 "../../../server-code/src/map/clif.c" + int +# 19008 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19008 "../../../server-code/src/map/clif.c" + ; + + +# 19010 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19010 "../../../server-code/src/map/clif.c" +va +# 19010 "../../../server-code/src/map/clif.c" 3 4 +) +# 19010 "../../../server-code/src/map/clif.c" + ; + + if( pos == 0xFFFF ) { + return; + } + + +# 19016 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_start( +# 19016 "../../../server-code/src/map/clif.c" +va +# 19016 "../../../server-code/src/map/clif.c" 3 4 +, +# 19016 "../../../server-code/src/map/clif.c" +len +# 19016 "../../../server-code/src/map/clif.c" 3 4 +) +# 19016 "../../../server-code/src/map/clif.c" + ; + + func = +# 19018 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19018 "../../../server-code/src/map/clif.c" + va +# 19018 "../../../server-code/src/map/clif.c" 3 4 + , +# 19018 "../../../server-code/src/map/clif.c" + pFunc +# 19018 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19018 "../../../server-code/src/map/clif.c" + ; + + packet_db[cmd].func = func; + + for (i = 0; i < 20; i++) { + pos = +# 19023 "../../../server-code/src/map/clif.c" 3 4 + __builtin_va_arg( +# 19023 "../../../server-code/src/map/clif.c" + va +# 19023 "../../../server-code/src/map/clif.c" 3 4 + , +# 19023 "../../../server-code/src/map/clif.c" + int +# 19023 "../../../server-code/src/map/clif.c" 3 4 + ) +# 19023 "../../../server-code/src/map/clif.c" + ; + + if (pos == 0xFFFF) + break; + + packet_db[cmd].pos[i] = pos; + } + +# 19030 "../../../server-code/src/map/clif.c" 3 4 +__builtin_va_end( +# 19030 "../../../server-code/src/map/clif.c" +va +# 19030 "../../../server-code/src/map/clif.c" 3 4 +) +# 19030 "../../../server-code/src/map/clif.c" + ; +} +void packetdb_loaddb(void) { + memset(packet_db,0,sizeof(packet_db)); + + + +# 1 "../../../server-code/src/map/packets.h" 1 +# 42 "../../../server-code/src/map/packets.h" +packetdb_addpacket((0x0064), (55), 0xFFFF); +packetdb_addpacket((0x0065), (17), 0xFFFF); +packetdb_addpacket((0x0066), (6), 0xFFFF); +packetdb_addpacket((0x0067), (37), 0xFFFF); +packetdb_addpacket((0x0068), (46), 0xFFFF); +packetdb_addpacket((0x0069), (-1), 0xFFFF); +packetdb_addpacket((0x006a), (23), 0xFFFF); +packetdb_addpacket((0x006b), (-1), 0xFFFF); +packetdb_addpacket((0x006c), (3), 0xFFFF); +packetdb_addpacket((0x006d), (108), 0xFFFF); +packetdb_addpacket((0x006e), (3), 0xFFFF); +packetdb_addpacket((0x006f), (2), 0xFFFF); +packetdb_addpacket((0x0070), (6), 0xFFFF); +packetdb_addpacket((0x0071), (28), 0xFFFF); +packetdb_addpacket((0x0072), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); +packetdb_addpacket((0x0073), (11), 0xFFFF); +packetdb_addpacket((0x0074), (3), 0xFFFF); +packetdb_addpacket((0x0075), (-1), 0xFFFF); +packetdb_addpacket((0x0076), (9), 0xFFFF); +packetdb_addpacket((0x0077), (5), 0xFFFF); +packetdb_addpacket((0x0078), (54), 0xFFFF); +packetdb_addpacket((0x0079), (53), 0xFFFF); +packetdb_addpacket((0x007a), (58), 0xFFFF); +packetdb_addpacket((0x007b), (60), 0xFFFF); +packetdb_addpacket((0x007c), (41), 0xFFFF); +packetdb_addpacket((0x007d), (2),clif->pLoadEndAck,0, 0xFFFF); +packetdb_addpacket((0x007e), (6),clif->pTickSend,2, 0xFFFF); +packetdb_addpacket((0x007f), (6), 0xFFFF); +packetdb_addpacket((0x0080), (7), 0xFFFF); +packetdb_addpacket((0x0081), (3), 0xFFFF); +packetdb_addpacket((0x0082), (2), 0xFFFF); +packetdb_addpacket((0x0083), (2), 0xFFFF); +packetdb_addpacket((0x0084), (2), 0xFFFF); +packetdb_addpacket((0x0085), (5),clif->pWalkToXY,2, 0xFFFF); +packetdb_addpacket((0x0086), (16), 0xFFFF); +packetdb_addpacket((0x0087), (12), 0xFFFF); +packetdb_addpacket((0x0088), (10), 0xFFFF); +packetdb_addpacket((0x0089), (7),clif->pActionRequest,2,6, 0xFFFF); +packetdb_addpacket((0x008a), (29), 0xFFFF); +packetdb_addpacket((0x008b), (2), 0xFFFF); +packetdb_addpacket((0x008c), (-1),clif->pGlobalMessage,2,4, 0xFFFF); +packetdb_addpacket((0x008d), (-1), 0xFFFF); +packetdb_addpacket((0x008e), (-1), 0xFFFF); + +packetdb_addpacket((0x0090), (7),clif->pNpcClicked,2, 0xFFFF); +packetdb_addpacket((0x0091), (22), 0xFFFF); +packetdb_addpacket((0x0092), (28), 0xFFFF); +packetdb_addpacket((0x0093), (2), 0xFFFF); +packetdb_addpacket((0x0094), (6),clif->pGetCharNameRequest,2, 0xFFFF); +packetdb_addpacket((0x0095), (30), 0xFFFF); +packetdb_addpacket((0x0096), (-1),clif->pWisMessage,2,4,28, 0xFFFF); +packetdb_addpacket((0x0097), (-1), 0xFFFF); +packetdb_addpacket((0x0098), (3), 0xFFFF); +packetdb_addpacket((0x0099), (-1),clif->pBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x009a), (-1), 0xFFFF); +packetdb_addpacket((0x009b), (5),clif->pChangeDir,2,4, 0xFFFF); +packetdb_addpacket((0x009c), (9), 0xFFFF); +packetdb_addpacket((0x009d), (17), 0xFFFF); +packetdb_addpacket((0x009e), (17), 0xFFFF); +packetdb_addpacket((0x009f), (6),clif->pTakeItem,2, 0xFFFF); +packetdb_addpacket((0x00a0), (23), 0xFFFF); +packetdb_addpacket((0x00a1), (6), 0xFFFF); +packetdb_addpacket((0x00a2), (6),clif->pDropItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a3), (-1), 0xFFFF); +packetdb_addpacket((0x00a4), (-1), 0xFFFF); +packetdb_addpacket((0x00a5), (-1), 0xFFFF); +packetdb_addpacket((0x00a6), (-1), 0xFFFF); +packetdb_addpacket((0x00a7), (8),clif->pUseItem,2,4, 0xFFFF); +packetdb_addpacket((0x00a8), (7), 0xFFFF); +packetdb_addpacket((0x00a9), (6),clif->pEquipItem,2,4, 0xFFFF); +packetdb_addpacket((0x00aa), (7), 0xFFFF); +packetdb_addpacket((0x00ab), (4),clif->pUnequipItem,2, 0xFFFF); +packetdb_addpacket((0x00ac), (7), 0xFFFF); + +packetdb_addpacket((0x00ae), (-1), 0xFFFF); +packetdb_addpacket((0x00af), (6), 0xFFFF); +packetdb_addpacket((0x00b0), (8), 0xFFFF); +packetdb_addpacket((0x00b1), (8), 0xFFFF); +packetdb_addpacket((0x00b2), (3),clif->pRestart,2, 0xFFFF); +packetdb_addpacket((0x00b3), (3), 0xFFFF); +packetdb_addpacket((0x00b4), (-1), 0xFFFF); +packetdb_addpacket((0x00b5), (6), 0xFFFF); +packetdb_addpacket((0x00b6), (6), 0xFFFF); +packetdb_addpacket((0x00b7), (-1), 0xFFFF); +packetdb_addpacket((0x00b8), (7),clif->pNpcSelectMenu,2,6, 0xFFFF); +packetdb_addpacket((0x00b9), (6),clif->pNpcNextClicked,2, 0xFFFF); +packetdb_addpacket((0x00ba), (2), 0xFFFF); +packetdb_addpacket((0x00bb), (5),clif->pStatusUp,2,4, 0xFFFF); +packetdb_addpacket((0x00bc), (6), 0xFFFF); +packetdb_addpacket((0x00bd), (44), 0xFFFF); +packetdb_addpacket((0x00be), (5), 0xFFFF); +packetdb_addpacket((0x00bf), (3),clif->pEmotion,2, 0xFFFF); +packetdb_addpacket((0x00c0), (7), 0xFFFF); +packetdb_addpacket((0x00c1), (2),clif->pHowManyConnections,0, 0xFFFF); +packetdb_addpacket((0x00c2), (6), 0xFFFF); +packetdb_addpacket((0x00c3), (8), 0xFFFF); +packetdb_addpacket((0x00c4), (6), 0xFFFF); +packetdb_addpacket((0x00c5), (7),clif->pNpcBuySellSelected,2,6, 0xFFFF); +packetdb_addpacket((0x00c6), (-1), 0xFFFF); +packetdb_addpacket((0x00c7), (-1), 0xFFFF); +packetdb_addpacket((0x00c8), (-1),clif->pNpcBuyListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00c9), (-1),clif->pNpcSellListSend,2,4, 0xFFFF); +packetdb_addpacket((0x00ca), (3), 0xFFFF); +packetdb_addpacket((0x00cb), (3), 0xFFFF); +packetdb_addpacket((0x00cc), (6),clif->pGMKick,2, 0xFFFF); +packetdb_addpacket((0x00cd), (3), 0xFFFF); +packetdb_addpacket((0x00ce), (2),clif->pGMKickAll,0, 0xFFFF); +packetdb_addpacket((0x00cf), (27),clif->pPMIgnore,2,26, 0xFFFF); +packetdb_addpacket((0x00d0), (3),clif->pPMIgnoreAll,2, 0xFFFF); +packetdb_addpacket((0x00d1), (4), 0xFFFF); +packetdb_addpacket((0x00d2), (4), 0xFFFF); +packetdb_addpacket((0x00d3), (2),clif->pPMIgnoreList,0, 0xFFFF); +packetdb_addpacket((0x00d4), (-1), 0xFFFF); +packetdb_addpacket((0x00d5), (-1),clif->pCreateChatRoom,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00d6), (3), 0xFFFF); +packetdb_addpacket((0x00d7), (-1), 0xFFFF); +packetdb_addpacket((0x00d8), (6), 0xFFFF); +packetdb_addpacket((0x00d9), (14),clif->pChatAddMember,2,6, 0xFFFF); +packetdb_addpacket((0x00da), (3), 0xFFFF); +packetdb_addpacket((0x00db), (-1), 0xFFFF); +packetdb_addpacket((0x00dc), (28), 0xFFFF); +packetdb_addpacket((0x00dd), (29), 0xFFFF); +packetdb_addpacket((0x00de), (-1),clif->pChatRoomStatusChange,2,4,6,7,15, 0xFFFF); +packetdb_addpacket((0x00df), (-1), 0xFFFF); +packetdb_addpacket((0x00e0), (30),clif->pChangeChatOwner,2,6, 0xFFFF); +packetdb_addpacket((0x00e1), (30), 0xFFFF); +packetdb_addpacket((0x00e2), (26),clif->pKickFromChat,2, 0xFFFF); +packetdb_addpacket((0x00e3), (2),clif->pChatLeave,0, 0xFFFF); +packetdb_addpacket((0x00e4), (6),clif->pTradeRequest,2, 0xFFFF); +packetdb_addpacket((0x00e5), (26), 0xFFFF); +packetdb_addpacket((0x00e6), (3),clif->pTradeAck,2, 0xFFFF); +packetdb_addpacket((0x00e7), (3), 0xFFFF); +packetdb_addpacket((0x00e8), (8),clif->pTradeAddItem,2,4, 0xFFFF); +packetdb_addpacket((0x00e9), (19), 0xFFFF); +packetdb_addpacket((0x00ea), (5), 0xFFFF); +packetdb_addpacket((0x00eb), (2),clif->pTradeOk,0, 0xFFFF); +packetdb_addpacket((0x00ec), (3), 0xFFFF); +packetdb_addpacket((0x00ed), (2),clif->pTradeCancel,0, 0xFFFF); +packetdb_addpacket((0x00ee), (2), 0xFFFF); +packetdb_addpacket((0x00ef), (2),clif->pTradeCommit,0, 0xFFFF); +packetdb_addpacket((0x00f0), (3), 0xFFFF); +packetdb_addpacket((0x00f1), (2), 0xFFFF); +packetdb_addpacket((0x00f2), (6), 0xFFFF); +packetdb_addpacket((0x00f3), (8),clif->pMoveToKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f4), (21), 0xFFFF); +packetdb_addpacket((0x00f5), (8),clif->pMoveFromKafra,2,4, 0xFFFF); +packetdb_addpacket((0x00f6), (8), 0xFFFF); +packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); +packetdb_addpacket((0x00f8), (2), 0xFFFF); +packetdb_addpacket((0x00f9), (26),clif->pCreateParty,2, 0xFFFF); +packetdb_addpacket((0x00fa), (3), 0xFFFF); +packetdb_addpacket((0x00fb), (-1), 0xFFFF); +packetdb_addpacket((0x00fc), (6),clif->pPartyInvite,2, 0xFFFF); +packetdb_addpacket((0x00fd), (27), 0xFFFF); +packetdb_addpacket((0x00fe), (30), 0xFFFF); +packetdb_addpacket((0x00ff), (10),clif->pReplyPartyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x0100), (2),clif->pLeaveParty,0, 0xFFFF); +packetdb_addpacket((0x0101), (6), 0xFFFF); +packetdb_addpacket((0x0102), (6),clif->pPartyChangeOption,2, 0xFFFF); +packetdb_addpacket((0x0103), (30),clif->pRemovePartyMember,2,6, 0xFFFF); +packetdb_addpacket((0x0104), (79), 0xFFFF); +packetdb_addpacket((0x0105), (31), 0xFFFF); +packetdb_addpacket((0x0106), (10), 0xFFFF); +packetdb_addpacket((0x0107), (10), 0xFFFF); +packetdb_addpacket((0x0108), (-1),clif->pPartyMessage,2,4, 0xFFFF); +packetdb_addpacket((0x0109), (-1), 0xFFFF); +packetdb_addpacket((0x010a), (4), 0xFFFF); +packetdb_addpacket((0x010b), (6), 0xFFFF); +packetdb_addpacket((0x010c), (6), 0xFFFF); +packetdb_addpacket((0x010d), (2), 0xFFFF); +packetdb_addpacket((0x010e), (11), 0xFFFF); +packetdb_addpacket((0x010f), (-1), 0xFFFF); +packetdb_addpacket((0x0110), (10), 0xFFFF); +packetdb_addpacket((0x0111), (39), 0xFFFF); +packetdb_addpacket((0x0112), (4),clif->pSkillUp,2, 0xFFFF); +packetdb_addpacket((0x0113), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); +packetdb_addpacket((0x0114), (31), 0xFFFF); +packetdb_addpacket((0x0115), (35), 0xFFFF); +packetdb_addpacket((0x0116), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x0117), (18), 0xFFFF); +packetdb_addpacket((0x0118), (2),clif->pStopAttack,0, 0xFFFF); +packetdb_addpacket((0x0119), (13), 0xFFFF); +packetdb_addpacket((0x011a), (15), 0xFFFF); +packetdb_addpacket((0x011b), (20),clif->pUseSkillMap,2,4, 0xFFFF); +packetdb_addpacket((0x011c), (68), 0xFFFF); +packetdb_addpacket((0x011d), (2),clif->pRequestMemo,0, 0xFFFF); +packetdb_addpacket((0x011e), (3), 0xFFFF); +packetdb_addpacket((0x011f), (16), 0xFFFF); +packetdb_addpacket((0x0120), (6), 0xFFFF); +packetdb_addpacket((0x0121), (14), 0xFFFF); +packetdb_addpacket((0x0122), (-1), 0xFFFF); +packetdb_addpacket((0x0123), (-1), 0xFFFF); +packetdb_addpacket((0x0124), (21), 0xFFFF); +packetdb_addpacket((0x0125), (8), 0xFFFF); +packetdb_addpacket((0x0126), (8),clif->pPutItemToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0127), (8),clif->pGetItemFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x0128), (8),clif->pMoveFromKafraToCart,2,4, 0xFFFF); +packetdb_addpacket((0x0129), (8),clif->pMoveToKafraFromCart,2,4, 0xFFFF); +packetdb_addpacket((0x012a), (2),clif->pRemoveOption,0, 0xFFFF); +packetdb_addpacket((0x012b), (2), 0xFFFF); +packetdb_addpacket((0x012c), (3), 0xFFFF); +packetdb_addpacket((0x012d), (4), 0xFFFF); +packetdb_addpacket((0x012e), (2),clif->pCloseVending,0, 0xFFFF); +packetdb_addpacket((0x012f), (-1), 0xFFFF); +packetdb_addpacket((0x0130), (6),clif->pVendingListReq,2, 0xFFFF); +packetdb_addpacket((0x0131), (86), 0xFFFF); +packetdb_addpacket((0x0132), (6), 0xFFFF); +packetdb_addpacket((0x0133), (-1), 0xFFFF); +packetdb_addpacket((0x0134), (-1),clif->pPurchaseReq,2,4,8, 0xFFFF); +packetdb_addpacket((0x0135), (7), 0xFFFF); +packetdb_addpacket((0x0136), (-1), 0xFFFF); +packetdb_addpacket((0x0137), (6), 0xFFFF); +packetdb_addpacket((0x0138), (3), 0xFFFF); +packetdb_addpacket((0x0139), (16), 0xFFFF); +packetdb_addpacket((0x013a), (4), 0xFFFF); +packetdb_addpacket((0x013b), (4), 0xFFFF); +packetdb_addpacket((0x013c), (4), 0xFFFF); +packetdb_addpacket((0x013d), (6), 0xFFFF); +packetdb_addpacket((0x013e), (24), 0xFFFF); +packetdb_addpacket((0x013f), (26),clif->pGM_Monster_Item,2, 0xFFFF); +packetdb_addpacket((0x0140), (22),clif->pMapMove,2,18,20, 0xFFFF); +packetdb_addpacket((0x0141), (14), 0xFFFF); +packetdb_addpacket((0x0142), (6), 0xFFFF); +packetdb_addpacket((0x0143), (10),clif->pNpcAmountInput,2,6, 0xFFFF); +packetdb_addpacket((0x0144), (23), 0xFFFF); +packetdb_addpacket((0x0145), (19), 0xFFFF); +packetdb_addpacket((0x0146), (6),clif->pNpcCloseClicked,2, 0xFFFF); +packetdb_addpacket((0x0147), (39), 0xFFFF); +packetdb_addpacket((0x0148), (8), 0xFFFF); +packetdb_addpacket((0x0149), (9),clif->pGMReqNoChat,2,6,7, 0xFFFF); +packetdb_addpacket((0x014a), (6), 0xFFFF); +packetdb_addpacket((0x014b), (27), 0xFFFF); +packetdb_addpacket((0x014c), (-1), 0xFFFF); +packetdb_addpacket((0x014d), (2),clif->pGuildCheckMaster,0, 0xFFFF); +packetdb_addpacket((0x014e), (6), 0xFFFF); +packetdb_addpacket((0x014f), (6),clif->pGuildRequestInfo,2, 0xFFFF); +packetdb_addpacket((0x0150), (110), 0xFFFF); +packetdb_addpacket((0x0151), (6),clif->pGuildRequestEmblem,2, 0xFFFF); +packetdb_addpacket((0x0152), (-1), 0xFFFF); +packetdb_addpacket((0x0153), (-1),clif->pGuildChangeEmblem,2,4, 0xFFFF); +packetdb_addpacket((0x0154), (-1), 0xFFFF); +packetdb_addpacket((0x0155), (-1),clif->pGuildChangeMemberPosition,2, 0xFFFF); +packetdb_addpacket((0x0156), (-1), 0xFFFF); +packetdb_addpacket((0x0157), (6), 0xFFFF); +packetdb_addpacket((0x0158), (-1), 0xFFFF); +packetdb_addpacket((0x0159), (54),clif->pGuildLeave,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015a), (66), 0xFFFF); +packetdb_addpacket((0x015b), (54),clif->pGuildExpulsion,2,6,10,14, 0xFFFF); +packetdb_addpacket((0x015c), (90), 0xFFFF); +packetdb_addpacket((0x015d), (42),clif->pGuildBreak,2, 0xFFFF); +packetdb_addpacket((0x015e), (6), 0xFFFF); +packetdb_addpacket((0x015f), (42), 0xFFFF); +packetdb_addpacket((0x0160), (-1), 0xFFFF); +packetdb_addpacket((0x0161), (-1),clif->pGuildChangePositionInfo,2, 0xFFFF); +packetdb_addpacket((0x0162), (-1), 0xFFFF); +packetdb_addpacket((0x0163), (-1), 0xFFFF); +packetdb_addpacket((0x0164), (-1), 0xFFFF); +packetdb_addpacket((0x0165), (30),clif->pCreateGuild,6, 0xFFFF); +packetdb_addpacket((0x0166), (-1), 0xFFFF); +packetdb_addpacket((0x0167), (3), 0xFFFF); +packetdb_addpacket((0x0168), (14),clif->pGuildInvite,2, 0xFFFF); +packetdb_addpacket((0x0169), (3), 0xFFFF); +packetdb_addpacket((0x016a), (30), 0xFFFF); +packetdb_addpacket((0x016b), (10),clif->pGuildReplyInvite,2,6, 0xFFFF); +packetdb_addpacket((0x016c), (43), 0xFFFF); +packetdb_addpacket((0x016d), (14), 0xFFFF); +packetdb_addpacket((0x016e), (186),clif->pGuildChangeNotice,2,6,66, 0xFFFF); +packetdb_addpacket((0x016f), (182), 0xFFFF); +packetdb_addpacket((0x0170), (14),clif->pGuildRequestAlliance,2, 0xFFFF); +packetdb_addpacket((0x0171), (30), 0xFFFF); +packetdb_addpacket((0x0172), (10),clif->pGuildReplyAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0173), (3), 0xFFFF); +packetdb_addpacket((0x0174), (-1), 0xFFFF); +packetdb_addpacket((0x0175), (6), 0xFFFF); +packetdb_addpacket((0x0176), (106), 0xFFFF); +packetdb_addpacket((0x0177), (-1), 0xFFFF); +packetdb_addpacket((0x0178), (4),clif->pItemIdentify,2, 0xFFFF); +packetdb_addpacket((0x0179), (5), 0xFFFF); +packetdb_addpacket((0x017a), (4),clif->pUseCard,2, 0xFFFF); +packetdb_addpacket((0x017b), (-1), 0xFFFF); +packetdb_addpacket((0x017c), (6),clif->pInsertCard,2,4, 0xFFFF); +packetdb_addpacket((0x017d), (7), 0xFFFF); +packetdb_addpacket((0x017e), (-1),clif->pGuildMessage,2,4, 0xFFFF); +packetdb_addpacket((0x017f), (-1), 0xFFFF); +packetdb_addpacket((0x0180), (6),clif->pGuildOpposition,2, 0xFFFF); +packetdb_addpacket((0x0181), (3), 0xFFFF); +packetdb_addpacket((0x0182), (106), 0xFFFF); +packetdb_addpacket((0x0183), (10),clif->pGuildDelAlliance,2,6, 0xFFFF); +packetdb_addpacket((0x0184), (10), 0xFFFF); +packetdb_addpacket((0x0185), (34), 0xFFFF); + +packetdb_addpacket((0x0187), (6), 0xFFFF); +packetdb_addpacket((0x0188), (8), 0xFFFF); +packetdb_addpacket((0x0189), (4), 0xFFFF); +packetdb_addpacket((0x018a), (4),clif->pQuitGame,0, 0xFFFF); +packetdb_addpacket((0x018b), (4), 0xFFFF); +packetdb_addpacket((0x018c), (29), 0xFFFF); +packetdb_addpacket((0x018d), (-1), 0xFFFF); +packetdb_addpacket((0x018e), (10),clif->pProduceMix,2,4,6,8, 0xFFFF); +packetdb_addpacket((0x018f), (6), 0xFFFF); +packetdb_addpacket((0x0190), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); +packetdb_addpacket((0x0191), (86), 0xFFFF); +packetdb_addpacket((0x0192), (24), 0xFFFF); +packetdb_addpacket((0x0193), (6),clif->pSolveCharName,2, 0xFFFF); +packetdb_addpacket((0x0194), (30), 0xFFFF); +packetdb_addpacket((0x0195), (102), 0xFFFF); +packetdb_addpacket((0x0196), (9), 0xFFFF); +packetdb_addpacket((0x0197), (4),clif->pResetChar,2, 0xFFFF); +packetdb_addpacket((0x0198), (8),clif->pGMChangeMapType,2,4,6, 0xFFFF); +packetdb_addpacket((0x0199), (4), 0xFFFF); +packetdb_addpacket((0x019a), (14), 0xFFFF); +packetdb_addpacket((0x019b), (10), 0xFFFF); +packetdb_addpacket((0x019c), (-1),clif->pLocalBroadcast,2,4, 0xFFFF); +packetdb_addpacket((0x019d), (6),clif->pGMHide,0, 0xFFFF); +packetdb_addpacket((0x019e), (2), 0xFFFF); +packetdb_addpacket((0x019f), (6),clif->pCatchPet,2, 0xFFFF); +packetdb_addpacket((0x01a0), (3), 0xFFFF); +packetdb_addpacket((0x01a1), (3),clif->pPetMenu,2, 0xFFFF); +packetdb_addpacket((0x01a2), (35), 0xFFFF); +packetdb_addpacket((0x01a3), (5), 0xFFFF); +packetdb_addpacket((0x01a4), (11), 0xFFFF); +packetdb_addpacket((0x01a5), (26),clif->pChangePetName,2, 0xFFFF); +packetdb_addpacket((0x01a6), (-1), 0xFFFF); +packetdb_addpacket((0x01a7), (4),clif->pSelectEgg,2, 0xFFFF); +packetdb_addpacket((0x01a8), (4), 0xFFFF); +packetdb_addpacket((0x01a9), (6),clif->pSendEmotion,2, 0xFFFF); +packetdb_addpacket((0x01aa), (10), 0xFFFF); +packetdb_addpacket((0x01ab), (12), 0xFFFF); +packetdb_addpacket((0x01ac), (6), 0xFFFF); +packetdb_addpacket((0x01ad), (-1), 0xFFFF); +packetdb_addpacket((0x01ae), (4),clif->pSelectArrow,2, 0xFFFF); +packetdb_addpacket((0x01af), (4),clif->pChangeCart,2, 0xFFFF); +packetdb_addpacket((0x01b0), (11), 0xFFFF); +packetdb_addpacket((0x01b1), (7), 0xFFFF); +packetdb_addpacket((0x01b2), (-1),clif->pOpenVending,2,4,84,85, 0xFFFF); +packetdb_addpacket((0x01b3), (67), 0xFFFF); +packetdb_addpacket((0x01b4), (12), 0xFFFF); +packetdb_addpacket((0x01b5), (18), 0xFFFF); +packetdb_addpacket((0x01b6), (114), 0xFFFF); +packetdb_addpacket((0x01b7), (6), 0xFFFF); +packetdb_addpacket((0x01b8), (3), 0xFFFF); +packetdb_addpacket((0x01b9), (6), 0xFFFF); +packetdb_addpacket((0x01ba), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bb), (26),clif->pGMShift,2, 0xFFFF); +packetdb_addpacket((0x01bc), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01bd), (26),clif->pGMRecall,2, 0xFFFF); +packetdb_addpacket((0x01be), (2), 0xFFFF); +packetdb_addpacket((0x01bf), (3), 0xFFFF); +packetdb_addpacket((0x01c0), (2), 0xFFFF); +packetdb_addpacket((0x01c1), (14), 0xFFFF); +packetdb_addpacket((0x01c2), (10), 0xFFFF); +packetdb_addpacket((0x01c3), (-1), 0xFFFF); +packetdb_addpacket((0x01c4), (22), 0xFFFF); +packetdb_addpacket((0x01c5), (22), 0xFFFF); +packetdb_addpacket((0x01c6), (4), 0xFFFF); +packetdb_addpacket((0x01c7), (2), 0xFFFF); +packetdb_addpacket((0x01c8), (13), 0xFFFF); +packetdb_addpacket((0x01c9), (97), 0xFFFF); + +packetdb_addpacket((0x01cb), (9), 0xFFFF); +packetdb_addpacket((0x01cc), (9), 0xFFFF); +packetdb_addpacket((0x01cd), (30), 0xFFFF); +packetdb_addpacket((0x01ce), (6),clif->pAutoSpell,2, 0xFFFF); +packetdb_addpacket((0x01cf), (28), 0xFFFF); +packetdb_addpacket((0x01d0), (8), 0xFFFF); +packetdb_addpacket((0x01d1), (14), 0xFFFF); +packetdb_addpacket((0x01d2), (10), 0xFFFF); +packetdb_addpacket((0x01d3), (35), 0xFFFF); +packetdb_addpacket((0x01d4), (6), 0xFFFF); +packetdb_addpacket((0x01d5), (-1),clif->pNpcStringInput,2,4,8, 0xFFFF); +packetdb_addpacket((0x01d6), (4), 0xFFFF); +packetdb_addpacket((0x01d7), (11), 0xFFFF); +packetdb_addpacket((0x01d8), (54), 0xFFFF); +packetdb_addpacket((0x01d9), (53), 0xFFFF); +packetdb_addpacket((0x01da), (60), 0xFFFF); +packetdb_addpacket((0x01db), (2), 0xFFFF); +packetdb_addpacket((0x01dc), (-1), 0xFFFF); +packetdb_addpacket((0x01dd), (47), 0xFFFF); +packetdb_addpacket((0x01de), (33), 0xFFFF); +packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); +packetdb_addpacket((0x01e0), (30), 0xFFFF); +packetdb_addpacket((0x01e1), (8), 0xFFFF); +packetdb_addpacket((0x01e2), (34), 0xFFFF); +packetdb_addpacket((0x01e3), (14), 0xFFFF); +packetdb_addpacket((0x01e4), (2), 0xFFFF); +packetdb_addpacket((0x01e5), (6), 0xFFFF); +packetdb_addpacket((0x01e6), (26), 0xFFFF); +packetdb_addpacket((0x01e7), (2),clif->pNoviceDoriDori,0, 0xFFFF); +packetdb_addpacket((0x01e8), (28),clif->pCreateParty2,2, 0xFFFF); +packetdb_addpacket((0x01e9), (81), 0xFFFF); +packetdb_addpacket((0x01ea), (6), 0xFFFF); +packetdb_addpacket((0x01eb), (10), 0xFFFF); +packetdb_addpacket((0x01ec), (26), 0xFFFF); +packetdb_addpacket((0x01ed), (2),clif->pNoviceExplosionSpirits,0, 0xFFFF); +packetdb_addpacket((0x01ee), (-1), 0xFFFF); +packetdb_addpacket((0x01ef), (-1), 0xFFFF); +packetdb_addpacket((0x01f0), (-1), 0xFFFF); +packetdb_addpacket((0x01f1), (-1), 0xFFFF); +packetdb_addpacket((0x01f2), (20), 0xFFFF); +packetdb_addpacket((0x01f3), (10), 0xFFFF); +packetdb_addpacket((0x01f4), (32), 0xFFFF); +packetdb_addpacket((0x01f5), (9), 0xFFFF); +packetdb_addpacket((0x01f6), (34), 0xFFFF); +packetdb_addpacket((0x01f7), (14),clif->pAdopt_reply,0, 0xFFFF); +packetdb_addpacket((0x01f8), (2), 0xFFFF); +packetdb_addpacket((0x01f9), (6),clif->pAdopt_request,0, 0xFFFF); +packetdb_addpacket((0x01fa), (48), 0xFFFF); +packetdb_addpacket((0x01fb), (56), 0xFFFF); +packetdb_addpacket((0x01fc), (-1), 0xFFFF); +packetdb_addpacket((0x01fd), (4),clif->pRepairItem,2, 0xFFFF); +packetdb_addpacket((0x01fe), (5), 0xFFFF); +packetdb_addpacket((0x01ff), (10), 0xFFFF); +packetdb_addpacket((0x0200), (26), 0xFFFF); +packetdb_addpacket((0x0201), (-1), 0xFFFF); +packetdb_addpacket((0x0202), (26),clif->pFriendsListAdd,2, 0xFFFF); +packetdb_addpacket((0x0203), (10),clif->pFriendsListRemove,2,6, 0xFFFF); +packetdb_addpacket((0x0204), (18), 0xFFFF); +packetdb_addpacket((0x0205), (26), 0xFFFF); +packetdb_addpacket((0x0206), (11), 0xFFFF); +packetdb_addpacket((0x0207), (34), 0xFFFF); +packetdb_addpacket((0x0208), (11),clif->pFriendsListReply,2,6,10, 0xFFFF); +packetdb_addpacket((0x0209), (36), 0xFFFF); +packetdb_addpacket((0x020a), (10), 0xFFFF); + + +packetdb_addpacket((0x020d), (-1), 0xFFFF); +packetdb_addpacket((0x974), (2),clif->cancelmergeitem, 0xFFFF); +packetdb_addpacket((0x96e), (-1),clif->ackmergeitems, 0xFFFF); + + + + packetdb_addpacket((0x0072), (22),clif->pWantToConnection,5,9,13,17,21, 0xFFFF); + packetdb_addpacket((0x0085), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (15),clif->pUseSkillToId,4,9,11, 0xFFFF); + packetdb_addpacket((0x0116), (15),clif->pUseSkillToPos,4,9,11,13, 0xFFFF); + packetdb_addpacket((0x0190), (95),clif->pUseSkillToPosMoreInfo,4,9,11,13,15, 0xFFFF); + packetdb_addpacket((0x0208), (14),clif->pFriendsListReply,2,6,10, 0xFFFF); + packetdb_addpacket((0x020e), (24), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (39),clif->pWantToConnection,12,22,30,34,38, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x009b), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x009f), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x00a7), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x0113), (19),clif->pUseSkillToId,7,9,15, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pUseSkillToPos,7,9,15,17, 0xFFFF); + packetdb_addpacket((0x0190), (99),clif->pUseSkillToPosMoreInfo,7,9,15,17,19, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x007e), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0085), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0089), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x008c), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x0094), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x009b), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x009f), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00a2), (103),clif->pUseSkillToPosMoreInfo,3,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x00a7), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (17),clif->pUseItem,6,12, 0xFFFF); + packetdb_addpacket((0x00f7), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0113), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0116), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (9),clif->pActionRequest,3,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x007e), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x0085), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x0089), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x008c), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0094), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pChangeDir,7,11, 0xFFFF); + packetdb_addpacket((0x00a2), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00f5), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x0113), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0193), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x0212), (26),clif->pGMRc,2, 0xFFFF); + packetdb_addpacket((0x0213), (26),clif->pCheck,2, 0xFFFF); + packetdb_addpacket((0x0214), (42), 0xFFFF); + + + + + packetdb_addpacket((0x020f), (10),clif->pPVPInfo,2,6, 0xFFFF); + packetdb_addpacket((0x0210), (22), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (20),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x007e), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x008c), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x009b), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x009f), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x00f3), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x00f5), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x00f7), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x0113), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x0116), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x0190), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x0193), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (18),clif->pUseItem,10,14, 0xFFFF); + packetdb_addpacket((0x007e), (25),clif->pMoveToKafra,6,21, 0xFFFF); + packetdb_addpacket((0x0085), (9),clif->pActionRequest,3,8, 0xFFFF); + packetdb_addpacket((0x0089), (14),clif->pWalkToXY,11, 0xFFFF); + packetdb_addpacket((0x008c), (109),clif->pUseSkillToPosMoreInfo,16,20,23,27,29, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pDropItem,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (29),clif->pUseSkillToPos,6,20,23,27, 0xFFFF); + packetdb_addpacket((0x00f3), (18),clif->pChangeDir,8,17, 0xFFFF); + packetdb_addpacket((0x00f5), (32),clif->pWantToConnection,10,17,23,27,31, 0xFFFF); + packetdb_addpacket((0x0113), (14),clif->pTakeItem,10, 0xFFFF); + packetdb_addpacket((0x0116), (14),clif->pTickSend,10, 0xFFFF); + packetdb_addpacket((0x0190), (14),clif->pUseSkillToId,4,7,10, 0xFFFF); + packetdb_addpacket((0x0193), (12),clif->pMoveFromKafra,4,8, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (17),clif->pUseItem,6,13, 0xFFFF); + packetdb_addpacket((0x007e), (16),clif->pMoveToKafra,5,12, 0xFFFF); + packetdb_addpacket((0x0089), (6),clif->pWalkToXY,3, 0xFFFF); + packetdb_addpacket((0x008c), (103),clif->pUseSkillToPosMoreInfo,2,6,17,21,23, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pDropItem,5,12, 0xFFFF); + packetdb_addpacket((0x009b), (15),clif->pGetCharNameRequest,11, 0xFFFF); + packetdb_addpacket((0x00a2), (12),clif->pSolveCharName,8, 0xFFFF); + packetdb_addpacket((0x00a7), (23),clif->pUseSkillToPos,3,6,17,21, 0xFFFF); + packetdb_addpacket((0x00f3), (13),clif->pChangeDir,5,12, 0xFFFF); + packetdb_addpacket((0x00f5), (33),clif->pWantToConnection,12,18,24,28,32, 0xFFFF); + packetdb_addpacket((0x0113), (10),clif->pTakeItem,6, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pTickSend,6, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pUseSkillToId,7,12,16, 0xFFFF); + packetdb_addpacket((0x0193), (26),clif->pMoveFromKafra,10,22, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (13),clif->pUseItem,5,9, 0xFFFF); + packetdb_addpacket((0x007e), (13),clif->pMoveToKafra,6,9, 0xFFFF); + packetdb_addpacket((0x0085), (15),clif->pActionRequest,4,14, 0xFFFF); + packetdb_addpacket((0x008c), (108),clif->pUseSkillToPosMoreInfo,6,9,23,26,28, 0xFFFF); + packetdb_addpacket((0x0094), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x009b), (10),clif->pGetCharNameRequest,6, 0xFFFF); + packetdb_addpacket((0x00a2), (16),clif->pSolveCharName,12, 0xFFFF); + packetdb_addpacket((0x00a7), (28),clif->pUseSkillToPos,6,9,23,26, 0xFFFF); + packetdb_addpacket((0x00f3), (15),clif->pChangeDir,6,14, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,5,14,20,24,28, 0xFFFF); + packetdb_addpacket((0x0113), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x0116), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x0190), (26),clif->pUseSkillToId,4,10,22, 0xFFFF); + packetdb_addpacket((0x0193), (22),clif->pMoveFromKafra,12,18, 0xFFFF); + + + + + packetdb_addpacket((0x0084), (-1), 0xFFFF); + packetdb_addpacket((0x0215), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0084), (2), 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x0218), (2),clif->pAlchemist,0, 0xFFFF); + packetdb_addpacket((0x0219), (282), 0xFFFF); + packetdb_addpacket((0x021a), (282), 0xFFFF); + packetdb_addpacket((0x021b), (10), 0xFFFF); + packetdb_addpacket((0x021c), (10), 0xFFFF); + + + + + packetdb_addpacket((0x021d), (6),clif->pLessEffect,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,8,12,18, 0xFFFF); + packetdb_addpacket((0x007e), (30),clif->pUseSkillToPos,4,9,22,28, 0xFFFF); + packetdb_addpacket((0x0085), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (13),clif->pGetCharNameRequest,9, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,4,10, 0xFFFF); + packetdb_addpacket((0x009b), (2),clif->pCloseKafra,0, 0xFFFF); + packetdb_addpacket((0x009f), (18),clif->pActionRequest,6,17, 0xFFFF); + packetdb_addpacket((0x00a2), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00a7), (7),clif->pWalkToXY,4, 0xFFFF); + packetdb_addpacket((0x00f3), (8),clif->pChangeDir,3,7, 0xFFFF); + packetdb_addpacket((0x00f5), (29),clif->pWantToConnection,3,10,20,24,28, 0xFFFF); + packetdb_addpacket((0x00f7), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x0113), (110),clif->pUseSkillToPosMoreInfo,4,9,22,28,30, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,4,10, 0xFFFF); + packetdb_addpacket((0x0190), (15),clif->pUseItem,3,11, 0xFFFF); + packetdb_addpacket((0x0193), (21),clif->pMoveFromKafra,4,17, 0xFFFF); + packetdb_addpacket((0x0221), (-1), 0xFFFF); + packetdb_addpacket((0x0222), (6),clif->pWeaponRefine,2, 0xFFFF); + packetdb_addpacket((0x0223), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x0066), (3), 0xFFFF); + packetdb_addpacket((0x0070), (3), 0xFFFF); + packetdb_addpacket((0x01ca), (3), 0xFFFF); + packetdb_addpacket((0x021e), (6), 0xFFFF); + packetdb_addpacket((0x021f), (66), 0xFFFF); + packetdb_addpacket((0x0220), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,8,16,22, 0xFFFF); + packetdb_addpacket((0x007e), (114),clif->pUseSkillToPosMoreInfo,10,18,22,32,34, 0xFFFF); + packetdb_addpacket((0x0085), (23),clif->pChangeDir,12,22, 0xFFFF); + packetdb_addpacket((0x0089), (9),clif->pTickSend,5, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (20),clif->pMoveToKafra,10,16, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,3,12,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (17),clif->pUseItem,5,13, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (13),clif->pWalkToXY,10, 0xFFFF); + packetdb_addpacket((0x00f3), (-1),clif->pGlobalMessage,2,4, 0xFFFF); + packetdb_addpacket((0x00f5), (9),clif->pTakeItem,5, 0xFFFF); + packetdb_addpacket((0x00f7), (21),clif->pMoveFromKafra,11,17, 0xFFFF); + packetdb_addpacket((0x0113), (34),clif->pUseSkillToPos,10,18,22,32, 0xFFFF); + packetdb_addpacket((0x0116), (20),clif->pDropItem,15,18, 0xFFFF); + packetdb_addpacket((0x0190), (20),clif->pActionRequest,9,19, 0xFFFF); + packetdb_addpacket((0x0193), (2),clif->pCloseKafra,0, 0xFFFF); + + + + + packetdb_addpacket((0x0224), (10), 0xFFFF); + packetdb_addpacket((0x0225), (2),clif->pTaekwon,0, 0xFFFF); + packetdb_addpacket((0x0226), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0227), (18), 0xFFFF); + packetdb_addpacket((0x0228), (18), 0xFFFF); + + + + + packetdb_addpacket((0x0229), (15), 0xFFFF); + packetdb_addpacket((0x022a), (58), 0xFFFF); + packetdb_addpacket((0x022b), (57), 0xFFFF); + packetdb_addpacket((0x022c), (64), 0xFFFF); + + + + + packetdb_addpacket((0x022d), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0232), (9),clif->pHomMoveTo,2,6, 0xFFFF); + packetdb_addpacket((0x0233), (11),clif->pHomAttack,2,6,10, 0xFFFF); + packetdb_addpacket((0x0234), (6),clif->pHomMoveToMaster,2, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x022e), (69), 0xFFFF); + packetdb_addpacket((0x0230), (12), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + packetdb_addpacket((0x0235), (-1), 0xFFFF); + packetdb_addpacket((0x0236), (10), 0xFFFF); + packetdb_addpacket((0x0237), (2),clif->pRankingPk,0, 0xFFFF); + packetdb_addpacket((0x0238), (282), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (2), 0xFFFF); + packetdb_addpacket((0x0239), (11), 0xFFFF); + + + + + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x0217), (2),clif->pBlacksmith,0, 0xFFFF); + packetdb_addpacket((0x022f), (5), 0xFFFF); + packetdb_addpacket((0x0231), (26),clif->pChangeHomunculusName,0, 0xFFFF); + packetdb_addpacket((0x023a), (4), 0xFFFF); + packetdb_addpacket((0x023b), (36),clif->pStoragePassword,2,4,20, 0xFFFF); + packetdb_addpacket((0x023c), (6), 0xFFFF); + + + + + packetdb_addpacket((0x022e), (71), 0xFFFF); + + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + packetdb_addpacket((0x0216), (-1), 0xFFFF); + packetdb_addpacket((0x023d), (-1), 0xFFFF); + packetdb_addpacket((0x023e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (19),clif->pUseSkillToId,5,11,15, 0xFFFF); + packetdb_addpacket((0x007e), (110),clif->pUseSkillToPosMoreInfo,9,15,23,28,30, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,6,10, 0xFFFF); + packetdb_addpacket((0x0089), (7),clif->pTickSend,3, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (21),clif->pMoveToKafra,12,17, 0xFFFF); + packetdb_addpacket((0x009b), (31),clif->pWantToConnection,3,13,22,26,30, 0xFFFF); + packetdb_addpacket((0x009f), (12),clif->pUseItem,3,8, 0xFFFF); + packetdb_addpacket((0x00a2), (18),clif->pSolveCharName,14, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (7),clif->pTakeItem,3, 0xFFFF); + packetdb_addpacket((0x00f7), (13),clif->pMoveFromKafra,5,9, 0xFFFF); + packetdb_addpacket((0x0113), (30),clif->pUseSkillToPos,9,15,23,28, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,6,10, 0xFFFF); + packetdb_addpacket((0x0190), (21),clif->pActionRequest,5,20, 0xFFFF); + packetdb_addpacket((0x0216), (6), 0xFFFF); + packetdb_addpacket((0x023f), (2),clif->pMail_refreshinbox,0, 0xFFFF); + packetdb_addpacket((0x0240), (8), 0xFFFF); + packetdb_addpacket((0x0241), (6),clif->pMail_read,2, 0xFFFF); + packetdb_addpacket((0x0242), (-1), 0xFFFF); + packetdb_addpacket((0x0243), (6),clif->pMail_delete,2, 0xFFFF); + packetdb_addpacket((0x0244), (6),clif->pMail_getattach,2, 0xFFFF); + packetdb_addpacket((0x0245), (7), 0xFFFF); + packetdb_addpacket((0x0246), (4),clif->pMail_winopen,2, 0xFFFF); + packetdb_addpacket((0x0247), (8),clif->pMail_setattach,2,4, 0xFFFF); + packetdb_addpacket((0x0248), (68), 0xFFFF); + packetdb_addpacket((0x0249), (3), 0xFFFF); + packetdb_addpacket((0x024a), (70), 0xFFFF); + packetdb_addpacket((0x024b), (4),clif->pAuction_cancelreg,0, 0xFFFF); + packetdb_addpacket((0x024c), (8),clif->pAuction_setitem,0, 0xFFFF); + packetdb_addpacket((0x024d), (14), 0xFFFF); + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x024f), (10),clif->pAuction_bid,0, 0xFFFF); + packetdb_addpacket((0x0250), (3), 0xFFFF); + packetdb_addpacket((0x0251), (2), 0xFFFF); + packetdb_addpacket((0x0252), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (34),clif->pUseSkillToId,6,17,30, 0xFFFF); + packetdb_addpacket((0x007e), (113),clif->pUseSkillToPosMoreInfo,12,15,18,31,33, 0xFFFF); + packetdb_addpacket((0x0085), (17),clif->pChangeDir,8,16, 0xFFFF); + packetdb_addpacket((0x0089), (13),clif->pTickSend,9, 0xFFFF); + packetdb_addpacket((0x008c), (8),clif->pGetCharNameRequest,4, 0xFFFF); + packetdb_addpacket((0x0094), (31),clif->pMoveToKafra,16,27, 0xFFFF); + packetdb_addpacket((0x009b), (32),clif->pWantToConnection,9,15,23,27,31, 0xFFFF); + packetdb_addpacket((0x009f), (19),clif->pUseItem,9,15, 0xFFFF); + packetdb_addpacket((0x00a2), (9),clif->pSolveCharName,5, 0xFFFF); + packetdb_addpacket((0x00a7), (11),clif->pWalkToXY,8, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (18),clif->pMoveFromKafra,11,14, 0xFFFF); + packetdb_addpacket((0x0113), (33),clif->pUseSkillToPos,12,15,18,31, 0xFFFF); + packetdb_addpacket((0x0116), (12),clif->pDropItem,3,10, 0xFFFF); + packetdb_addpacket((0x0190), (24),clif->pActionRequest,11,23, 0xFFFF); + + + + + packetdb_addpacket((0x0245), (3), 0xFFFF); + packetdb_addpacket((0x0251), (4), 0xFFFF); + + + + + packetdb_addpacket((0x024d), (12),clif->pAuction_register,0, 0xFFFF); + packetdb_addpacket((0x024e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0253), (3), 0xFFFF); + packetdb_addpacket((0x0254), (3),clif->pFeelSaveOk,0, 0xFFFF); + + + + + packetdb_addpacket((0x0240), (-1), 0xFFFF); + packetdb_addpacket((0x0248), (-1),clif->pMail_send,2,4,28,68, 0xFFFF); + packetdb_addpacket((0x0255), (5), 0xFFFF); + packetdb_addpacket((0x0256), (-1), 0xFFFF); + packetdb_addpacket((0x0257), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0256), (5), 0xFFFF); + packetdb_addpacket((0x0258), (2), 0xFFFF); + packetdb_addpacket((0x0259), (3), 0xFFFF); + + + + + packetdb_addpacket((0x020e), (32), 0xFFFF); + packetdb_addpacket((0x025a), (-1), 0xFFFF); + packetdb_addpacket((0x025b), (6),clif->pCooking,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (6), 0xFFFF); + packetdb_addpacket((0x0251), (32), 0xFFFF); + packetdb_addpacket((0x025c), (4),clif->pAuction_buysell,0, 0xFFFF); + + + + + packetdb_addpacket((0x007a), (58), 0xFFFF); + packetdb_addpacket((0x025d), (6),clif->pAuction_close,0, 0xFFFF); + packetdb_addpacket((0x025e), (4), 0xFFFF); + + + + + packetdb_addpacket((0x025f), (6), 0xFFFF); + packetdb_addpacket((0x0260), (6), 0xFFFF); + + + + + packetdb_addpacket((0x024e), (6),clif->pAuction_cancel,0, 0xFFFF); + packetdb_addpacket((0x0251), (34),clif->pAuction_search,0, 0xFFFF); + + + + + packetdb_addpacket((0x0261), (11), 0xFFFF); + packetdb_addpacket((0x0262), (11), 0xFFFF); + packetdb_addpacket((0x0263), (11), 0xFFFF); + packetdb_addpacket((0x0264), (20), 0xFFFF); + packetdb_addpacket((0x0265), (20), 0xFFFF); + packetdb_addpacket((0x0266), (30), 0xFFFF); + packetdb_addpacket((0x0267), (4), 0xFFFF); + packetdb_addpacket((0x0268), (4), 0xFFFF); + packetdb_addpacket((0x0269), (4), 0xFFFF); + packetdb_addpacket((0x026a), (4), 0xFFFF); + packetdb_addpacket((0x026b), (4), 0xFFFF); + packetdb_addpacket((0x026c), (4), 0xFFFF); + packetdb_addpacket((0x026d), (4), 0xFFFF); + packetdb_addpacket((0x026f), (2), 0xFFFF); + packetdb_addpacket((0x0270), (2), 0xFFFF); + packetdb_addpacket((0x0271), (38), 0xFFFF); + packetdb_addpacket((0x0272), (44), 0xFFFF); + + + + + packetdb_addpacket((0x0271), (40), 0xFFFF); + + + + + + packetdb_addpacket((0x0273), (6), 0xFFFF); + packetdb_addpacket((0x0274), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0273), (30),clif->pMail_return,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x0072), (26),clif->pUseSkillToId,11,18,22, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,5,15,29,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (12),clif->pChangeDir,7,11, 0xFFFF); + + packetdb_addpacket((0x008c), (12),clif->pGetCharNameRequest,8, 0xFFFF); + packetdb_addpacket((0x0094), (23),clif->pMoveToKafra,5,19, 0xFFFF); + packetdb_addpacket((0x009b), (37),clif->pWantToConnection,9,21,28,32,36, 0xFFFF); + packetdb_addpacket((0x009f), (24),clif->pUseItem,9,20, 0xFFFF); + packetdb_addpacket((0x00a2), (11),clif->pSolveCharName,7, 0xFFFF); + packetdb_addpacket((0x00a7), (15),clif->pWalkToXY,12, 0xFFFF); + packetdb_addpacket((0x00f5), (13),clif->pTakeItem,9, 0xFFFF); + packetdb_addpacket((0x00f7), (26),clif->pMoveFromKafra,11,22, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,5,15,29,38, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,8,15, 0xFFFF); + packetdb_addpacket((0x0190), (18),clif->pActionRequest,7,17, 0xFFFF); + + + + + packetdb_addpacket((0x006d), (110), 0xFFFF); + + + + + packetdb_addpacket((0x023e), (8), 0xFFFF); + packetdb_addpacket((0x0277), (84), 0xFFFF); + packetdb_addpacket((0x0278), (2), 0xFFFF); + packetdb_addpacket((0x0279), (2), 0xFFFF); + packetdb_addpacket((0x027a), (-1), 0xFFFF); + packetdb_addpacket((0x027b), (14), 0xFFFF); + packetdb_addpacket((0x027c), (60), 0xFFFF); + packetdb_addpacket((0x027d), (62), 0xFFFF); + packetdb_addpacket((0x027e), (-1), 0xFFFF); + packetdb_addpacket((0x027f), (8), 0xFFFF); + packetdb_addpacket((0x0280), (12), 0xFFFF); + packetdb_addpacket((0x0281), (4), 0xFFFF); + packetdb_addpacket((0x0282), (284), 0xFFFF); + packetdb_addpacket((0x0283), (6), 0xFFFF); + packetdb_addpacket((0x0284), (14), 0xFFFF); + packetdb_addpacket((0x0285), (6), 0xFFFF); + packetdb_addpacket((0x0286), (4), 0xFFFF); + packetdb_addpacket((0x0287), (-1), 0xFFFF); + packetdb_addpacket((0x0288), (6), 0xFFFF); + packetdb_addpacket((0x0289), (8), 0xFFFF); + packetdb_addpacket((0x028a), (18), 0xFFFF); + packetdb_addpacket((0x028b), (-1), 0xFFFF); + packetdb_addpacket((0x028c), (46), 0xFFFF); + packetdb_addpacket((0x028d), (34), 0xFFFF); + packetdb_addpacket((0x028e), (4), 0xFFFF); + packetdb_addpacket((0x028f), (6), 0xFFFF); + packetdb_addpacket((0x0290), (4), 0xFFFF); + packetdb_addpacket((0x0291), (4), 0xFFFF); + packetdb_addpacket((0x0292), (2),clif->pAutoRevive,0, 0xFFFF); + packetdb_addpacket((0x0293), (70), 0xFFFF); + packetdb_addpacket((0x0294), (10), 0xFFFF); + packetdb_addpacket((0x0295), (-1), 0xFFFF); + packetdb_addpacket((0x0296), (-1), 0xFFFF); + packetdb_addpacket((0x0297), (-1), 0xFFFF); + packetdb_addpacket((0x0298), (8), 0xFFFF); + packetdb_addpacket((0x0299), (6), 0xFFFF); + packetdb_addpacket((0x029a), (27), 0xFFFF); + packetdb_addpacket((0x029c), (66), 0xFFFF); + packetdb_addpacket((0x029d), (-1), 0xFFFF); + packetdb_addpacket((0x029e), (11), 0xFFFF); + packetdb_addpacket((0x029f), (3),clif->pmercenary_action,0, 0xFFFF); + packetdb_addpacket((0x02a0), (-1), 0xFFFF); + packetdb_addpacket((0x02a1), (-1), 0xFFFF); + packetdb_addpacket((0x02a2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (30),clif->pUseSkillToId,10,14,26, 0xFFFF); + packetdb_addpacket((0x007e), (120),clif->pUseSkillToPosMoreInfo,10,19,23,38,40, 0xFFFF); + packetdb_addpacket((0x0085), (14),clif->pChangeDir,10,13, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (17),clif->pGetCharNameRequest,13, 0xFFFF); + packetdb_addpacket((0x0094), (17),clif->pMoveToKafra,4,13, 0xFFFF); + packetdb_addpacket((0x009b), (35),clif->pWantToConnection,7,21,26,30,34, 0xFFFF); + packetdb_addpacket((0x009f), (21),clif->pUseItem,7,17, 0xFFFF); + packetdb_addpacket((0x00a2), (10),clif->pSolveCharName,6, 0xFFFF); + packetdb_addpacket((0x00a7), (8),clif->pWalkToXY,5, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (15),clif->pMoveFromKafra,3,11, 0xFFFF); + packetdb_addpacket((0x0113), (40),clif->pUseSkillToPos,10,19,23,38, 0xFFFF); + packetdb_addpacket((0x0116), (19),clif->pDropItem,11,17, 0xFFFF); + packetdb_addpacket((0x0190), (10),clif->pActionRequest,4,9, 0xFFFF); + + + + + packetdb_addpacket((0x02a3), (18), 0xFFFF); + packetdb_addpacket((0x02a4), (2), 0xFFFF); + + + + + packetdb_addpacket((0x029b), (72), 0xFFFF); + packetdb_addpacket((0x02a3), (-1), 0xFFFF); + packetdb_addpacket((0x02a4), (-1), 0xFFFF); + packetdb_addpacket((0x02a5), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x02aa), (4), 0xFFFF); + packetdb_addpacket((0x02ab), (36), 0xFFFF); + packetdb_addpacket((0x02ac), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (25),clif->pUseSkillToId,6,10,21, 0xFFFF); + packetdb_addpacket((0x007e), (102),clif->pUseSkillToPosMoreInfo,5,9,12,20,22, 0xFFFF); + packetdb_addpacket((0x0085), (11),clif->pChangeDir,7,10, 0xFFFF); + packetdb_addpacket((0x0089), (8),clif->pTickSend,4, 0xFFFF); + packetdb_addpacket((0x008c), (11),clif->pGetCharNameRequest,7, 0xFFFF); + packetdb_addpacket((0x0094), (14),clif->pMoveToKafra,7,10, 0xFFFF); + packetdb_addpacket((0x009b), (26),clif->pWantToConnection,4,9,17,21,25, 0xFFFF); + packetdb_addpacket((0x009f), (14),clif->pUseItem,4,10, 0xFFFF); + packetdb_addpacket((0x00a2), (15),clif->pSolveCharName,11, 0xFFFF); + + packetdb_addpacket((0x00f5), (8),clif->pTakeItem,4, 0xFFFF); + packetdb_addpacket((0x00f7), (22),clif->pMoveFromKafra,14,18, 0xFFFF); + packetdb_addpacket((0x0113), (22),clif->pUseSkillToPos,5,9,12,20, 0xFFFF); + packetdb_addpacket((0x0116), (10),clif->pDropItem,5,8, 0xFFFF); + packetdb_addpacket((0x0190), (19),clif->pActionRequest,5,18, 0xFFFF); + + + + + packetdb_addpacket((0x01fd), (15),clif->pRepairItem,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (10),clif->pcashshop_buy,2,4,6, 0xFFFF); + packetdb_addpacket((0x0289), (12), 0xFFFF); + packetdb_addpacket((0x02a6), (22), 0xFFFF); + packetdb_addpacket((0x02a7), (22), 0xFFFF); + packetdb_addpacket((0x02a8), (162), 0xFFFF); + packetdb_addpacket((0x02a9), (58), 0xFFFF); + packetdb_addpacket((0x02ad), (8), 0xFFFF); + packetdb_addpacket((0x02b0), (85), 0xFFFF); + packetdb_addpacket((0x02b1), (-1), 0xFFFF); + packetdb_addpacket((0x02b2), (-1), 0xFFFF); + packetdb_addpacket((0x02b3), (107), 0xFFFF); + packetdb_addpacket((0x02b4), (6), 0xFFFF); + packetdb_addpacket((0x02b5), (-1), 0xFFFF); + packetdb_addpacket((0x02b6), (7),clif->pquestStateAck,2,6, 0xFFFF); + packetdb_addpacket((0x02b7), (7), 0xFFFF); + packetdb_addpacket((0x02b8), (22), 0xFFFF); + packetdb_addpacket((0x02b9), (191), 0xFFFF); + packetdb_addpacket((0x02ba), (11),clif->pHotkey,2,4,5,9, 0xFFFF); + packetdb_addpacket((0x02bb), (8), 0xFFFF); + packetdb_addpacket((0x02bc), (6), 0xFFFF); + packetdb_addpacket((0x02bf), (10), 0xFFFF); + packetdb_addpacket((0x02c0), (2), 0xFFFF); + packetdb_addpacket((0x02c1), (-1), 0xFFFF); + packetdb_addpacket((0x02c2), (-1), 0xFFFF); + packetdb_addpacket((0x02c4), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x02c5), (30), 0xFFFF); + packetdb_addpacket((0x02c6), (30), 0xFFFF); + packetdb_addpacket((0x02c7), (7),clif->pReplyPartyInvite2,2,6, 0xFFFF); + packetdb_addpacket((0x02c8), (3),clif->pPartyTick,2, 0xFFFF); + packetdb_addpacket((0x02c9), (3), 0xFFFF); + packetdb_addpacket((0x02ca), (3), 0xFFFF); + packetdb_addpacket((0x02cb), (20), 0xFFFF); + packetdb_addpacket((0x02cc), (4), 0xFFFF); + packetdb_addpacket((0x02cd), (26), 0xFFFF); + packetdb_addpacket((0x02ce), (10), 0xFFFF); + packetdb_addpacket((0x02cf), (6), 0xFFFF); + packetdb_addpacket((0x02d0), (-1), 0xFFFF); + packetdb_addpacket((0x02d1), (-1), 0xFFFF); + packetdb_addpacket((0x02d2), (-1), 0xFFFF); + packetdb_addpacket((0x02d3), (4), 0xFFFF); + packetdb_addpacket((0x02d4), (29), 0xFFFF); + packetdb_addpacket((0x02d5), (2), 0xFFFF); + packetdb_addpacket((0x02d6), (6),clif->pViewPlayerEquip,2, 0xFFFF); + packetdb_addpacket((0x02d7), (-1), 0xFFFF); + packetdb_addpacket((0x02d8), (10),clif->pEquipTick,6, 0xFFFF); + packetdb_addpacket((0x02d9), (10), 0xFFFF); + packetdb_addpacket((0x02da), (3), 0xFFFF); + packetdb_addpacket((0x02db), (-1),clif->pBattleChat,2,4, 0xFFFF); + packetdb_addpacket((0x02dc), (-1), 0xFFFF); + packetdb_addpacket((0x02dd), (32), 0xFFFF); + packetdb_addpacket((0x02de), (6), 0xFFFF); + packetdb_addpacket((0x02df), (36), 0xFFFF); + packetdb_addpacket((0x02e0), (34), 0xFFFF); + + + + + packetdb_addpacket((0x02cb), (65), 0xFFFF); + packetdb_addpacket((0x02cd), (71), 0xFFFF); + + + + + packetdb_addpacket((0x0078), (55), 0xFFFF); + packetdb_addpacket((0x007c), (42), 0xFFFF); + packetdb_addpacket((0x022c), (65), 0xFFFF); + packetdb_addpacket((0x029b), (80), 0xFFFF); + + + + + packetdb_addpacket((0x02e1), (33), 0xFFFF); + + + + + + packetdb_addpacket((0x02e2), (14), 0xFFFF); + packetdb_addpacket((0x02e3), (25), 0xFFFF); + packetdb_addpacket((0x02e4), (8), 0xFFFF); + packetdb_addpacket((0x02e5), (8), 0xFFFF); + packetdb_addpacket((0x02e6), (6), 0xFFFF); + + + + + packetdb_addpacket((0x02e7), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x01df), (6),clif->pGMReqAccountName,2, 0xFFFF); + packetdb_addpacket((0x02e8), (-1), 0xFFFF); + packetdb_addpacket((0x02e9), (-1), 0xFFFF); + packetdb_addpacket((0x02ea), (-1), 0xFFFF); + packetdb_addpacket((0x02eb), (13), 0xFFFF); + packetdb_addpacket((0x02ec), (67), 0xFFFF); + packetdb_addpacket((0x02ed), (59), 0xFFFF); + packetdb_addpacket((0x02ee), (60), 0xFFFF); + packetdb_addpacket((0x02ef), (8), 0xFFFF); + + + + + packetdb_addpacket((0x02bf), (-1), 0xFFFF); + packetdb_addpacket((0x02c0), (-1), 0xFFFF); + packetdb_addpacket((0x02f0), (10), 0xFFFF); + packetdb_addpacket((0x02f1), (2),clif->pProgressbar,0, 0xFFFF); + packetdb_addpacket((0x02f2), (2), 0xFFFF); + + + + + packetdb_addpacket((0x02f3), (-1), 0xFFFF); + packetdb_addpacket((0x02f4), (-1), 0xFFFF); + packetdb_addpacket((0x02f5), (-1), 0xFFFF); + packetdb_addpacket((0x02f6), (-1), 0xFFFF); + packetdb_addpacket((0x02f7), (-1), 0xFFFF); + packetdb_addpacket((0x02f8), (-1), 0xFFFF); + packetdb_addpacket((0x02f9), (-1), 0xFFFF); + packetdb_addpacket((0x02fa), (-1), 0xFFFF); + packetdb_addpacket((0x02fb), (-1), 0xFFFF); + packetdb_addpacket((0x02fc), (-1), 0xFFFF); + packetdb_addpacket((0x02fd), (-1), 0xFFFF); + packetdb_addpacket((0x02fe), (-1), 0xFFFF); + packetdb_addpacket((0x02ff), (-1), 0xFFFF); + packetdb_addpacket((0x0300), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0301), (-1), 0xFFFF); + packetdb_addpacket((0x0302), (-1), 0xFFFF); + packetdb_addpacket((0x0303), (-1), 0xFFFF); + packetdb_addpacket((0x0304), (-1), 0xFFFF); + packetdb_addpacket((0x0305), (-1), 0xFFFF); + packetdb_addpacket((0x0306), (-1), 0xFFFF); + packetdb_addpacket((0x0307), (-1), 0xFFFF); + packetdb_addpacket((0x0308), (-1), 0xFFFF); + packetdb_addpacket((0x0309), (-1), 0xFFFF); + packetdb_addpacket((0x030a), (-1), 0xFFFF); + packetdb_addpacket((0x030b), (-1), 0xFFFF); + packetdb_addpacket((0x030c), (-1), 0xFFFF); + packetdb_addpacket((0x030d), (-1), 0xFFFF); + packetdb_addpacket((0x030e), (-1), 0xFFFF); + packetdb_addpacket((0x030f), (-1), 0xFFFF); + packetdb_addpacket((0x0310), (-1), 0xFFFF); + packetdb_addpacket((0x0311), (-1), 0xFFFF); + packetdb_addpacket((0x0312), (-1), 0xFFFF); + packetdb_addpacket((0x0313), (-1), 0xFFFF); + packetdb_addpacket((0x0314), (-1), 0xFFFF); + packetdb_addpacket((0x0315), (-1), 0xFFFF); + packetdb_addpacket((0x0316), (-1), 0xFFFF); + packetdb_addpacket((0x0317), (-1), 0xFFFF); + packetdb_addpacket((0x0318), (-1), 0xFFFF); + packetdb_addpacket((0x0319), (-1), 0xFFFF); + packetdb_addpacket((0x031a), (-1), 0xFFFF); + packetdb_addpacket((0x031b), (-1), 0xFFFF); + packetdb_addpacket((0x031c), (-1), 0xFFFF); + packetdb_addpacket((0x031d), (-1), 0xFFFF); + packetdb_addpacket((0x031e), (-1), 0xFFFF); + packetdb_addpacket((0x031f), (-1), 0xFFFF); + packetdb_addpacket((0x0320), (-1), 0xFFFF); + packetdb_addpacket((0x0321), (-1), 0xFFFF); + packetdb_addpacket((0x0322), (-1), 0xFFFF); + packetdb_addpacket((0x0323), (-1), 0xFFFF); + packetdb_addpacket((0x0324), (-1), 0xFFFF); + packetdb_addpacket((0x0325), (-1), 0xFFFF); + packetdb_addpacket((0x0326), (-1), 0xFFFF); + packetdb_addpacket((0x0327), (-1), 0xFFFF); + packetdb_addpacket((0x0328), (-1), 0xFFFF); + packetdb_addpacket((0x0329), (-1), 0xFFFF); + packetdb_addpacket((0x032a), (-1), 0xFFFF); + packetdb_addpacket((0x032b), (-1), 0xFFFF); + packetdb_addpacket((0x032c), (-1), 0xFFFF); + packetdb_addpacket((0x032d), (-1), 0xFFFF); + packetdb_addpacket((0x032e), (-1), 0xFFFF); + packetdb_addpacket((0x032f), (-1), 0xFFFF); + packetdb_addpacket((0x0330), (-1), 0xFFFF); + packetdb_addpacket((0x0331), (-1), 0xFFFF); + packetdb_addpacket((0x0332), (-1), 0xFFFF); + packetdb_addpacket((0x0333), (-1), 0xFFFF); + packetdb_addpacket((0x0334), (-1), 0xFFFF); + packetdb_addpacket((0x0335), (-1), 0xFFFF); + packetdb_addpacket((0x0336), (-1), 0xFFFF); + packetdb_addpacket((0x0337), (-1), 0xFFFF); + packetdb_addpacket((0x0338), (-1), 0xFFFF); + packetdb_addpacket((0x0339), (-1), 0xFFFF); + packetdb_addpacket((0x033a), (-1), 0xFFFF); + packetdb_addpacket((0x033b), (-1), 0xFFFF); + packetdb_addpacket((0x033c), (-1), 0xFFFF); + packetdb_addpacket((0x033d), (-1), 0xFFFF); + packetdb_addpacket((0x033e), (-1), 0xFFFF); + packetdb_addpacket((0x033f), (-1), 0xFFFF); + packetdb_addpacket((0x0340), (-1), 0xFFFF); + packetdb_addpacket((0x0341), (-1), 0xFFFF); + packetdb_addpacket((0x0342), (-1), 0xFFFF); + packetdb_addpacket((0x0343), (-1), 0xFFFF); + packetdb_addpacket((0x0344), (-1), 0xFFFF); + packetdb_addpacket((0x0345), (-1), 0xFFFF); + packetdb_addpacket((0x0346), (-1), 0xFFFF); + packetdb_addpacket((0x0347), (-1), 0xFFFF); + packetdb_addpacket((0x0348), (-1), 0xFFFF); + packetdb_addpacket((0x0349), (-1), 0xFFFF); + packetdb_addpacket((0x034a), (-1), 0xFFFF); + packetdb_addpacket((0x034b), (-1), 0xFFFF); + packetdb_addpacket((0x034c), (-1), 0xFFFF); + packetdb_addpacket((0x034d), (-1), 0xFFFF); + packetdb_addpacket((0x034e), (-1), 0xFFFF); + packetdb_addpacket((0x034f), (-1), 0xFFFF); + packetdb_addpacket((0x0350), (-1), 0xFFFF); + packetdb_addpacket((0x0351), (-1), 0xFFFF); + packetdb_addpacket((0x0352), (-1), 0xFFFF); + packetdb_addpacket((0x0353), (-1), 0xFFFF); + packetdb_addpacket((0x0354), (-1), 0xFFFF); + packetdb_addpacket((0x0355), (-1), 0xFFFF); + packetdb_addpacket((0x0356), (-1), 0xFFFF); + packetdb_addpacket((0x0357), (-1), 0xFFFF); + packetdb_addpacket((0x0358), (-1), 0xFFFF); + packetdb_addpacket((0x0359), (-1), 0xFFFF); + packetdb_addpacket((0x035a), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x035b), (-1), 0xFFFF); + packetdb_addpacket((0x035c), (2), 0xFFFF); + packetdb_addpacket((0x035d), (-1), 0xFFFF); + packetdb_addpacket((0x035e), (2), 0xFFFF); + packetdb_addpacket((0x035f), (-1), 0xFFFF); + packetdb_addpacket((0x0389), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x040c), (-1), 0xFFFF); + packetdb_addpacket((0x040d), (-1), 0xFFFF); + packetdb_addpacket((0x040e), (-1), 0xFFFF); + packetdb_addpacket((0x040f), (-1), 0xFFFF); + packetdb_addpacket((0x0410), (-1), 0xFFFF); + packetdb_addpacket((0x0411), (-1), 0xFFFF); + packetdb_addpacket((0x0412), (-1), 0xFFFF); + packetdb_addpacket((0x0413), (-1), 0xFFFF); + packetdb_addpacket((0x0414), (-1), 0xFFFF); + packetdb_addpacket((0x0415), (-1), 0xFFFF); + packetdb_addpacket((0x0416), (-1), 0xFFFF); + packetdb_addpacket((0x0417), (-1), 0xFFFF); + packetdb_addpacket((0x0418), (-1), 0xFFFF); + packetdb_addpacket((0x0419), (-1), 0xFFFF); + packetdb_addpacket((0x041a), (-1), 0xFFFF); + packetdb_addpacket((0x041b), (-1), 0xFFFF); + packetdb_addpacket((0x041c), (-1), 0xFFFF); + packetdb_addpacket((0x041d), (-1), 0xFFFF); + packetdb_addpacket((0x041e), (-1), 0xFFFF); + packetdb_addpacket((0x041f), (-1), 0xFFFF); + packetdb_addpacket((0x0420), (-1), 0xFFFF); + packetdb_addpacket((0x0421), (-1), 0xFFFF); + packetdb_addpacket((0x0422), (-1), 0xFFFF); + packetdb_addpacket((0x0423), (-1), 0xFFFF); + packetdb_addpacket((0x0424), (-1), 0xFFFF); + packetdb_addpacket((0x0425), (-1), 0xFFFF); + packetdb_addpacket((0x0426), (-1), 0xFFFF); + packetdb_addpacket((0x0427), (-1), 0xFFFF); + packetdb_addpacket((0x0428), (-1), 0xFFFF); + packetdb_addpacket((0x0429), (-1), 0xFFFF); + packetdb_addpacket((0x042a), (-1), 0xFFFF); + packetdb_addpacket((0x042b), (-1), 0xFFFF); + packetdb_addpacket((0x042c), (-1), 0xFFFF); + packetdb_addpacket((0x042d), (-1), 0xFFFF); + packetdb_addpacket((0x042e), (-1), 0xFFFF); + packetdb_addpacket((0x042f), (-1), 0xFFFF); + packetdb_addpacket((0x0430), (-1), 0xFFFF); + packetdb_addpacket((0x0431), (-1), 0xFFFF); + packetdb_addpacket((0x0432), (-1), 0xFFFF); + packetdb_addpacket((0x0433), (-1), 0xFFFF); + packetdb_addpacket((0x0434), (-1), 0xFFFF); + packetdb_addpacket((0x0435), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + packetdb_addpacket((0x043e), (-1), 0xFFFF); + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); + packetdb_addpacket((0x0440), (10), 0xFFFF); + packetdb_addpacket((0x0441), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0442), (-1), 0xFFFF); + packetdb_addpacket((0x0443), (8),clif->pSkillSelectMenu,2,6, 0xFFFF); + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); + packetdb_addpacket((0x0444), (-1), 0xFFFF); + packetdb_addpacket((0x0445), (10), 0xFFFF); + + + + + packetdb_addpacket((0x0446), (14), 0xFFFF); + + + + + packetdb_addpacket((0x0448), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0449), (4), 0xFFFF); + + + + + packetdb_addpacket((0x02a6), (-1), 0xFFFF); + packetdb_addpacket((0x02a7), (-1), 0xFFFF); + packetdb_addpacket((0x044a), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0072), (22),clif->pUseSkillToId,9,15,18, 0xFFFF); + packetdb_addpacket((0x007c), (44), 0xFFFF); + packetdb_addpacket((0x007e), (105),clif->pUseSkillToPosMoreInfo,10,14,18,23,25, 0xFFFF); + packetdb_addpacket((0x0085), (10),clif->pChangeDir,4,9, 0xFFFF); + packetdb_addpacket((0x0089), (11),clif->pTickSend,7, 0xFFFF); + packetdb_addpacket((0x008c), (14),clif->pGetCharNameRequest,10, 0xFFFF); + packetdb_addpacket((0x0094), (19),clif->pMoveToKafra,3,15, 0xFFFF); + packetdb_addpacket((0x009b), (34),clif->pWantToConnection,7,15,25,29,33, 0xFFFF); + packetdb_addpacket((0x009f), (20),clif->pUseItem,7,20, 0xFFFF); + packetdb_addpacket((0x00a2), (14),clif->pSolveCharName,10, 0xFFFF); + packetdb_addpacket((0x00a7), (9),clif->pWalkToXY,6, 0xFFFF); + packetdb_addpacket((0x00f5), (11),clif->pTakeItem,7, 0xFFFF); + packetdb_addpacket((0x00f7), (17),clif->pMoveFromKafra,3,13, 0xFFFF); + packetdb_addpacket((0x0113), (25),clif->pUseSkillToPos,10,14,18,23, 0xFFFF); + packetdb_addpacket((0x0116), (17),clif->pDropItem,6,15, 0xFFFF); + packetdb_addpacket((0x0190), (23),clif->pActionRequest,9,22, 0xFFFF); + packetdb_addpacket((0x02e2), (20), 0xFFFF); + packetdb_addpacket((0x02e3), (22), 0xFFFF); + packetdb_addpacket((0x02e4), (11), 0xFFFF); + packetdb_addpacket((0x02e5), (9), 0xFFFF); + + + + + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + + packetdb_addpacket((0x043d), (8), 0xFFFF); + + packetdb_addpacket((0x043f), (8), 0xFFFF); + + + + + packetdb_addpacket((0x01a2), (37), 0xFFFF); +# 1501 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x006d), (114), 0xFFFF); + + + + + + packetdb_addpacket((0x043f), (25), 0xFFFF); +# 1546 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d7), (8),clif->pPartyChangeOption,2,6,7, 0xFFFF); + packetdb_addpacket((0x07d8), (8), 0xFFFF); + packetdb_addpacket((0x07d9), (254), 0xFFFF); + packetdb_addpacket((0x07da), (6),clif->pPartyChangeLeader,2, 0xFFFF); +# 1559 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07d9), (268), 0xFFFF); +# 1579 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07e1), (15), 0xFFFF); + + + + + packetdb_addpacket((0x07e2), (8), 0xFFFF); + + + + + packetdb_addpacket((0x07e3), (6), 0xFFFF); + packetdb_addpacket((0x07e4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07e7), (5), 0xFFFF); + + + + + packetdb_addpacket((0x07e5), (8), 0xFFFF); + packetdb_addpacket((0x07e6), (8), 0xFFFF); + packetdb_addpacket((0x07e7), (32), 0xFFFF); + packetdb_addpacket((0x07e8), (-1), 0xFFFF); + packetdb_addpacket((0x07e9), (5), 0xFFFF); +# 1635 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x07f5), (6),clif->pGMFullStrip,2, 0xFFFF); + packetdb_addpacket((0x07f6), (14), 0xFFFF); + + + + + packetdb_addpacket((0x07f7), (-1), 0xFFFF); + packetdb_addpacket((0x07f8), (-1), 0xFFFF); + packetdb_addpacket((0x07f9), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x07fa), (8), 0xFFFF); + + + + + + packetdb_addpacket((0x07fb), (25), 0xFFFF); + + + + + + + packetdb_addpacket((0x07fe), (26), 0xFFFF); + + + + + + packetdb_addpacket((0x0800), (-1), 0xFFFF); + + + + + + packetdb_addpacket((0x0802), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0803), (4), 0xFFFF); + packetdb_addpacket((0x0804), (8), 0xFFFF); + packetdb_addpacket((0x0805), (-1), 0xFFFF); + packetdb_addpacket((0x0806), (4),clif->pPartyBookingDeleteReq,2, 0xFFFF); + + packetdb_addpacket((0x0808), (4), 0xFFFF); +# 1688 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0804), (14),clif->pPartyBookingSearchReq,2,4,6,8,12, 0xFFFF); + packetdb_addpacket((0x0806), (2),clif->pPartyBookingDeleteReq,0, 0xFFFF); + packetdb_addpacket((0x0807), (4), 0xFFFF); + packetdb_addpacket((0x0808), (14),clif->pPartyBookingUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x0809), (50), 0xFFFF); + packetdb_addpacket((0x080A), (18), 0xFFFF); + packetdb_addpacket((0x080B), (6), 0xFFFF); + + + + + packetdb_addpacket((0x0801), (-1),clif->pPurchaseReq2,2,4,8,12, 0xFFFF); + + + + + + + packetdb_addpacket((0x080E), (14), 0xFFFF); +# 1716 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x080F), (20), 0xFFFF); + + + + + packetdb_addpacket((0x0810), (3), 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); +# 1734 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0813), (-1), 0xFFFF); + + + packetdb_addpacket((0x0816), (6), 0xFFFF); + packetdb_addpacket((0x0818), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x081d), (22), 0xFFFF); + packetdb_addpacket((0x081e), (8), 0xFFFF); +# 1760 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0820), (11), 0xFFFF); +# 1773 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0812), (8), 0xFFFF); + packetdb_addpacket((0x0814), (86), 0xFFFF); + packetdb_addpacket((0x0815), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x081a), (4), 0xFFFF); + packetdb_addpacket((0x081b), (10), 0xFFFF); + packetdb_addpacket((0x081c), (10), 0xFFFF); + packetdb_addpacket((0x0824), (6), 0xFFFF); + + + + + + + packetdb_addpacket((0x0835), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0836), (-1), 0xFFFF); + packetdb_addpacket((0x0837), (3), 0xFFFF); + + + + + + packetdb_addpacket((0x0838), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x083A), (4), 0xFFFF); + packetdb_addpacket((0x083B), (2),clif->pCloseSearchStoreInfo,0, 0xFFFF); + packetdb_addpacket((0x083C), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x083D), (6), 0xFFFF); +# 1815 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x00AA), (9), 0xFFFF); + + + + + + + + packetdb_addpacket((0x083A), (5), 0xFFFF); +# 1845 "../../../server-code/src/map/packets.h" + packetdb_addpacket((0x0839), (66), 0xFFFF); + packetdb_addpacket((0x0842), (6),clif->pGMRecall2,2, 0xFFFF); + packetdb_addpacket((0x0843), (6),clif->pGMRemove2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x0436), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x035f), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0365), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0366), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0367), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0856), (-1), 0xFFFF); + packetdb_addpacket((0x0857), (-1), 0xFFFF); + packetdb_addpacket((0x0858), (-1), 0xFFFF); + packetdb_addpacket((0x0859), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0844), (2),clif->pCashShopOpen,2, 0xFFFF); + packetdb_addpacket((0x084a), (2),clif->pCashShopClose,2, 0xFFFF); + packetdb_addpacket((0x0846), (4),clif->pCashShopReqTab,2, 0xFFFF); + packetdb_addpacket((0x08c9), (2),clif->pCashShopSchedule,0, 0xFFFF); + packetdb_addpacket((0x0848), (-1),clif->pCashShopBuy,2, 0xFFFF); + + + + + packetdb_addpacket((0x0364), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0817), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0366), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0815), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0893), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0897), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0369), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x08ad), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0838), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x08d7), (28),clif->pBGQueueRegister,2, 0xFFFF); + packetdb_addpacket((0x090a), (26),clif->pBGQueueCheckState,2, 0xFFFF); + packetdb_addpacket((0x08da), (26),clif->pBGQueueRevokeReq,2, 0xFFFF); + packetdb_addpacket((0x08e0), (51),clif->pBGQueueBattleBeginAck,2, 0xFFFF); + + + + + packetdb_addpacket((0x0436), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0898), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0281), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x088d), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x083c), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08aa), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02c4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x890), (8), 0xFFFF); + packetdb_addpacket((0x08a5), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x089b), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x08a1), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x089e), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x08ab), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x088b), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x08a2), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + + packetdb_addpacket((0x0835), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0892), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0899), (6),clif->pTickSend,2, 0xFFFF); + + + + + + packetdb_addpacket((0x086A), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0887), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0890), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x02C4), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x093B), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0963), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0369), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0863), (5),clif->pHomMenu,4, 0xFFFF); + packetdb_addpacket((0x0861), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0929), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0885), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0889), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0870), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0884), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x01FD), (15),clif->pRepairItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0885), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0961), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0288), (-1),clif->pcashshop_buy,4,8, 0xFFFF); + packetdb_addpacket((0x091C), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x094B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0945), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0871), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0891), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x086C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08A6), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0889), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0884), (6),clif->pSolveCharName,2, 0xFFFF); + + packetdb_addpacket((0x091D), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + + + + packetdb_addpacket((0x08E6), (4), 0xFFFF); + packetdb_addpacket((0x08E7), (10),clif->pPartyRecruitSearchReq,2, 0xFFFF); + packetdb_addpacket((0x08E8), (-1), 0xFFFF); + packetdb_addpacket((0x08E9), (2),clif->pPartyRecruitDeleteReq,2, 0xFFFF); + packetdb_addpacket((0x08EA), (4), 0xFFFF); + packetdb_addpacket((0x08EB), (39),clif->pPartyRecruitUpdateReq,2, 0xFFFF); + packetdb_addpacket((0x08EC), (73), 0xFFFF); + packetdb_addpacket((0x08ED), (43), 0xFFFF); + packetdb_addpacket((0x08EE), (6), 0xFFFF); + + + + + + packetdb_addpacket((0x08F2), (36), 0xFFFF); + packetdb_addpacket((0x08F3), (-1), 0xFFFF); + packetdb_addpacket((0x08F4), (6), 0xFFFF); + packetdb_addpacket((0x08F5), (-1),clif->pDull,2,4, 0xFFFF); + packetdb_addpacket((0x08F6), (22), 0xFFFF); + packetdb_addpacket((0x08F7), (3), 0xFFFF); + packetdb_addpacket((0x08F8), (7), 0xFFFF); + packetdb_addpacket((0x08F9), (6), 0xFFFF); + + + + packetdb_addpacket((0x08FA), (6), 0xFFFF); + packetdb_addpacket((0x08FB), (6),clif->pDull,2, 0xFFFF); + packetdb_addpacket((0x0907), (5),clif->pMoveItem,2,4, 0xFFFF); + packetdb_addpacket((0x0908), (5), 0xFFFF); + packetdb_addpacket((0x08CF), (10), 0xFFFF); + packetdb_addpacket((0x0977), (14), 0xFFFF); + + + + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A8), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x08E5), (41),clif->pPartyRecruitRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x08d2), (10), 0xFFFF); + packetdb_addpacket((0x0916), (26),clif->pGuildInvite2,2, 0xFFFF); + + + + + packetdb_addpacket((0x0861), (18),clif->pPartyRecruitRegisterReq,2,4,6, 0xFFFF); + + + + + + packetdb_addpacket((0x0983), (29), 0xFFFF); + + + + + + + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0364), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x085a), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0861), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0862), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0863), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0886), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0889), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x089e), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x089f), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08a0), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x094a), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0953), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pChangeDir,2,4, 0xFFFF); + + + + + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + + + + + packetdb_addpacket((0x0879), (18),clif->pPartyBookingRegisterReq,2,4,6, 0xFFFF); + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0819), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0439), (8),clif->pUseItem,2,4, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0940), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + + + + + + packetdb_addpacket((0x088E), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x089B), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0881), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0363), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0897), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0933), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0874), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0959), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x094C), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0365), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x092E), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x094E), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0922), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0886), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0938), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x085D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0868), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0888), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x086D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x086F), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0947), (36),clif->pStoragePassword,0, 0xFFFF); + + + + packetdb_addpacket((0x0998), (8),clif->pEquipItem,2,4, 0xFFFF); + packetdb_addpacket((0x0447), (2), 0xFFFF); + packetdb_addpacket((0x099f), (24), 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0362), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x08A1), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AC), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x092D), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0963), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0943), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0947), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0962), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0931), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x093E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x08A2), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x095C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0925), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x095E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x089C), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x08A3), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x087E), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0811), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0964), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x08A6), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0369), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x093E), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x08AA), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x095B), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0952), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x086E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0874), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x089B), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x086A), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x08A9), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0950), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0362), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0926), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + packetdb_addpacket((0x0890), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0876), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0897), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0951), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x08A7), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0957), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0917), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x085E), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0863), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x085A), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0918), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0892), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0964), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0869), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0874), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0958), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0877), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x023B), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0956), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0883), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x097C), (4),clif->pRanklist, 0xFFFF); + + + + + packetdb_addpacket((0x087E), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0919), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0940), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0964), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0889), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0951), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x088E), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0930), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A6), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0962), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0917), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x096A), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x094F), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0944), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0945), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0890), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0363), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0281), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0891), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0862), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x085A), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0932), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x08A7), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0942), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x095B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0887), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0953), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x02C4), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094D), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x088B), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0952), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0921), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0817), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0365), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0894), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A5), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x088C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0895), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0960), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0930), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0930), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0360), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x09A6), (12), 0xFFFF); + packetdb_addpacket((0x09A7), (10),clif->pBankDeposit,2,4,6, 0xFFFF); + packetdb_addpacket((0x09A8), (16), 0xFFFF); + packetdb_addpacket((0x09A9), (10),clif->pBankWithdraw,2,4,6, 0xFFFF); + packetdb_addpacket((0x09AA), (16), 0xFFFF); + packetdb_addpacket((0x09AB), (6),clif->pBankCheck,2,4, 0xFFFF); + + packetdb_addpacket((0x09B6), (6),clif->pBankOpen,2,4, 0xFFFF); + packetdb_addpacket((0x09B7), (4), 0xFFFF); + packetdb_addpacket((0x09B8), (6),clif->pBankClose,2,4, 0xFFFF); + packetdb_addpacket((0x09B9), (4), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0874), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0947), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093A), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x088C), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x095F), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0873), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0887), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0962), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0937), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0923), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0868), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0941), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0889), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0835), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0895), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094E), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0936), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + + + + packetdb_addpacket((0x0959), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + + packetdb_addpacket((0x08A4), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0368), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0927), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0281), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0958), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0885), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0947), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x022D), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x092F), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x08AB), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0811), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x085C), (36),clif->pStoragePassword,0, 0xFFFF); + + packetdb_addpacket((0x09d4), (2),clif->pNPCShopClosed, 0xFFFF); + packetdb_addpacket((0x09ce), (102),clif->pGM_Monster_Item,2, 0xFFFF); + + packetdb_addpacket((0x09d8), (2),clif->pNPCMarketClosed, 0xFFFF); + packetdb_addpacket((0x09d6), (-1),clif->pNPCMarketPurchase, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022d), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x08A4), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09df), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0871), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x02C4), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x035F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0438), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x094A), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x092A), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0860), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0968), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0895), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x091E), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x096A), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0926), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0898), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x087B), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0369), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x093D), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x087F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0969), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x094C), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0365), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x091F), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x022D), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x089C), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x08A9), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x0943), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0949), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x091D), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08A7), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0940), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0361), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x088E), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0367), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x0802), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0360), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x096A), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0965), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x096A), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0965), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0966), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x095D), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x092D), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0865), (36),clif->pStoragePassword,0, 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0938), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0815), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0202), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0436), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0361), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0438), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x07E4), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0934), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095e), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0946), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x0868), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x093F), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x0950), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0360), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0882), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x085B), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x092D), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x088A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x07EC), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0965), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x085D), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0933), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x091F), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x023B), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0867), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0944), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x08AC), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0883), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0920), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0890), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x089A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0896), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0926), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0202), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0364), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x022D), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x023B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0361), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x095C), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0967), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x07E4), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0362), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x07EC), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x022D), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0365), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x086E), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0802), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x094B), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0364), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0936), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09DF), (7), 0xFFFF); + packetdb_addpacket((0x0a00), (269), 0xFFFF); + + + + + packetdb_addpacket((0x0A19), (2),clif->pRouletteOpen,0, 0xFFFF); + packetdb_addpacket((0x0A1A), (23), 0xFFFF); + packetdb_addpacket((0x0A1B), (2),clif->pRouletteInfo,0, 0xFFFF); + packetdb_addpacket((0x0A1C), (-1), 0xFFFF); + packetdb_addpacket((0x0A1D), (2),clif->pRouletteClose,0, 0xFFFF); + packetdb_addpacket((0x0A1E), (3), 0xFFFF); + packetdb_addpacket((0x0A1F), (2),clif->pRouletteGenerate,0, 0xFFFF); + packetdb_addpacket((0x0A20), (21), 0xFFFF); + packetdb_addpacket((0x0A21), (3),clif->pRouletteRecvItem,2, 0xFFFF); + packetdb_addpacket((0x0A22), (5), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x08AD), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x094E), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x087D), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0878), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x08AA), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x023B), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0835), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0940), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x0817), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0955), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + + packetdb_addpacket((0x0281), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x093B), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x0896), (26),clif->pPartyInvite2,2, 0xFFFF); + + packetdb_addpacket((0x091A), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0899), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x0A01), (3),clif->pHotkeyRowShift,2, 0xFFFF); + + + + packetdb_addpacket((0x0A09), (45), 0xFFFF); + packetdb_addpacket((0x0A0A), (47), 0xFFFF); + packetdb_addpacket((0x0A0B), (47), 0xFFFF); + packetdb_addpacket((0x0A0C), (56), 0xFFFF); + packetdb_addpacket((0x0A0D), (-1), 0xFFFF); + packetdb_addpacket((0x0A0F), (-1), 0xFFFF); + packetdb_addpacket((0x0A10), (-1), 0xFFFF); + + + + + packetdb_addpacket((0x0369), (7),clif->pActionRequest,2,6, 0xFFFF); + packetdb_addpacket((0x083C), (10),clif->pUseSkillToId,2,4,6, 0xFFFF); + packetdb_addpacket((0x0437), (5),clif->pWalkToXY,2, 0xFFFF); + packetdb_addpacket((0x035F), (6),clif->pTickSend,2, 0xFFFF); + packetdb_addpacket((0x0924), (5),clif->pChangeDir,2,4, 0xFFFF); + packetdb_addpacket((0x0958), (6),clif->pTakeItem,2, 0xFFFF); + packetdb_addpacket((0x0885), (6),clif->pDropItem,2,4, 0xFFFF); + packetdb_addpacket((0x0879), (8),clif->pMoveToKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0864), (8),clif->pMoveFromKafra,2,4, 0xFFFF); + packetdb_addpacket((0x0438), (10),clif->pUseSkillToPos,2,4,6,8, 0xFFFF); + packetdb_addpacket((0x0366), (90),clif->pUseSkillToPosMoreInfo,2,4,6,8,10, 0xFFFF); + packetdb_addpacket((0x096A), (6),clif->pGetCharNameRequest,2, 0xFFFF); + packetdb_addpacket((0x0368), (6),clif->pSolveCharName,2, 0xFFFF); + packetdb_addpacket((0x0838), (12),clif->pSearchStoreInfoListItemClick,2,6,10, 0xFFFF); + packetdb_addpacket((0x0835), (2),clif->pSearchStoreInfoNextPage,0, 0xFFFF); + packetdb_addpacket((0x0819), (-1),clif->pSearchStoreInfo,2,4,5,9,13,14,15, 0xFFFF); + packetdb_addpacket((0x0811), (-1),clif->pReqTradeBuyingStore,2,4,8,12, 0xFFFF); + packetdb_addpacket((0x0360), (6),clif->pReqClickBuyingStore,2, 0xFFFF); + packetdb_addpacket((0x022D), (2),clif->pReqCloseBuyingStore,0, 0xFFFF); + packetdb_addpacket((0x0815), (-1),clif->pReqOpenBuyingStore,2,4,8,9,89, 0xFFFF); + packetdb_addpacket((0x0883), (18),clif->pPartyBookingRegisterReq,2,4, 0xFFFF); + packetdb_addpacket((0x02C4), (8), 0xFFFF); + packetdb_addpacket((0x0960), (-1),clif->pItemListWindowSelected,2,4,8, 0xFFFF); + packetdb_addpacket((0x0363), (19),clif->pWantToConnection,2,6,10,14,18, 0xFFFF); + packetdb_addpacket((0x094A), (26),clif->pPartyInvite2,2, 0xFFFF); + packetdb_addpacket((0x0927), (4), 0xFFFF); + packetdb_addpacket((0x08A8), (26),clif->pFriendsListAdd,2, 0xFFFF); + packetdb_addpacket((0x0817), (5),clif->pHomMenu,2,4, 0xFFFF); + packetdb_addpacket((0x0923), (36),clif->pStoragePassword,0, 0xFFFF); + packetdb_addpacket((0x09E8), (11),clif->pDull, 0xFFFF); + packetdb_addpacket((0x0A2E), (6),clif->pDull, 0xFFFF); + packetdb_addpacket((0x0A02), (4), 0xFFFF); + packetdb_addpacket((0x0A35), (4),clif->pOneClick_ItemIdentify,2, 0xFFFF); + + + + packetdb_addpacket((0x097f), (-1), 0xFFFF); + packetdb_addpacket((0x0980), (7),clif->pSelectCart, 0xFFFF); + + + + + do { clif->cryptKey[0] = (0x053D5CED); clif->cryptKey[1] = (0x3DED6DED); clif->cryptKey[2] = (0x6DED6DED); } while(0); + + + + do { clif->cryptKey[0] = (0x35C91401); clif->cryptKey[1] = (0x262A5556); clif->cryptKey[2] = (0x28FA03AA); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x3AD67ED0); clif->cryptKey[1] = (0x44703C69); clif->cryptKey[2] = (0x6F876809); } while(0); + + + + do { clif->cryptKey[0] = (0x291E6762); clif->cryptKey[1] = (0x77CD391A); clif->cryptKey[2] = (0x60AC2F16); } while(0); + + + + do { clif->cryptKey[0] = (0x7F3C2D29); clif->cryptKey[1] = (0x59B01DE6); clif->cryptKey[2] = (0x1DBB44CA); } while(0); + + + + do { clif->cryptKey[0] = (0x357D55DC); clif->cryptKey[1] = (0x5A8D759F); clif->cryptKey[2] = (0x245C30F5); } while(0); + + + + do { clif->cryptKey[0] = (0x50AE1A63); clif->cryptKey[1] = (0x3CE579B5); clif->cryptKey[2] = (0x29C10406); } while(0); + + + + do { clif->cryptKey[0] = (0x5324329D); clif->cryptKey[1] = (0x5D545D52); clif->cryptKey[2] = (0x06137269); } while(0); + + + + do { clif->cryptKey[0] = (0x0B642BDA); clif->cryptKey[1] = (0x6ECB1D1C); clif->cryptKey[2] = (0x61C7454B); } while(0); + + + + do { clif->cryptKey[0] = (0x3B550F07); clif->cryptKey[1] = (0x1F666C7C); clif->cryptKey[2] = (0x60304EF5); } while(0); + + + + do { clif->cryptKey[0] = (0x2A610886); clif->cryptKey[1] = (0x3E09165E); clif->cryptKey[2] = (0x57C11888); } while(0); + + + + do { clif->cryptKey[0] = (0x5151306B); clif->cryptKey[1] = (0x7AE32886); clif->cryptKey[2] = (0x53060628); } while(0); + + + + do { clif->cryptKey[0] = (0x05D53871); clif->cryptKey[1] = (0x7D0027B4); clif->cryptKey[2] = (0x29975333); } while(0); + + + + do { clif->cryptKey[0] = (0x0FF87E93); clif->cryptKey[1] = (0x6CFF7860); clif->cryptKey[2] = (0x3A3D1DEC); } while(0); + + + + do { clif->cryptKey[0] = (0x262034A1); clif->cryptKey[1] = (0x674542A5); clif->cryptKey[2] = (0x73A50BA5); } while(0); + + + + do { clif->cryptKey[0] = (0x2B412AFC); clif->cryptKey[1] = (0x4FF94487); clif->cryptKey[2] = (0x6705339D); } while(0); + + + + do { clif->cryptKey[0] = (0x504345D0); clif->cryptKey[1] = (0x3D427B1B); clif->cryptKey[2] = (0x794C2DCC); } while(0); + + + + do { clif->cryptKey[0] = (0x2CFC0A71); clif->cryptKey[1] = (0x2BA91D8D); clif->cryptKey[2] = (0x087E39E0); } while(0); + + + + do { clif->cryptKey[0] = (0x1D373F5D); clif->cryptKey[1] = (0x5ACD604D); clif->cryptKey[2] = (0x1C4D7C4D); } while(0); + + + + do { clif->cryptKey[0] = (0x7A255EFA); clif->cryptKey[1] = (0x30977276); clif->cryptKey[2] = (0x2D4A0448); } while(0); + + + + do { clif->cryptKey[0] = (0x520B4C64); clif->cryptKey[1] = (0x2800407D); clif->cryptKey[2] = (0x47651458); } while(0); + + + + do { clif->cryptKey[0] = (0x382A6DEF); clif->cryptKey[1] = (0x5CBE7202); clif->cryptKey[2] = (0x61F46637); } while(0); + + + + do { clif->cryptKey[0] = (0x689C1729); clif->cryptKey[1] = (0x11812639); clif->cryptKey[2] = (0x60F82967); } while(0); + + + + do { clif->cryptKey[0] = (0x21F9683F); clif->cryptKey[1] = (0x710C5CA5); clif->cryptKey[2] = (0x1FD910E9); } while(0); + + + + do { clif->cryptKey[0] = (0x75B8553B); clif->cryptKey[1] = (0x37F20B12); clif->cryptKey[2] = (0x385C2B40); } while(0); + + + + do { clif->cryptKey[0] = (0x0036310C); clif->cryptKey[1] = (0x2DCD0BED); clif->cryptKey[2] = (0x1EE62A78); } while(0); + + + + do { clif->cryptKey[0] = (0x01581359); clif->cryptKey[1] = (0x452D6FFA); clif->cryptKey[2] = (0x6AFB6E2E); } while(0); + + + + do { clif->cryptKey[0] = (0x01540E48); clif->cryptKey[1] = (0x13041224); clif->cryptKey[2] = (0x31247924); } while(0); + + + + do { clif->cryptKey[0] = (0x411D1DBB); clif->cryptKey[1] = (0x4CBA4848); clif->cryptKey[2] = (0x1A432FC4); } while(0); + + + + do { clif->cryptKey[0] = (0x16CF3301); clif->cryptKey[1] = (0x1F472B9B); clif->cryptKey[2] = (0x0B4A3CD2); } while(0); + + + + do { clif->cryptKey[0] = (0x4A715EF9); clif->cryptKey[1] = (0x79103E4F); clif->cryptKey[2] = (0x405C1238); } while(0); + + + + do { clif->cryptKey[0] = (0x70EB4CCB); clif->cryptKey[1] = (0x0487713C); clif->cryptKey[2] = (0x398D4B08); } while(0); + + + + do { clif->cryptKey[0] = (0x68CA3080); clif->cryptKey[1] = (0x31B74BDD); clif->cryptKey[2] = (0x505208F1); } while(0); + + + + do { clif->cryptKey[0] = (0x32E45D64); clif->cryptKey[1] = (0x35643564); clif->cryptKey[2] = (0x35643564); } while(0); + + + + do { clif->cryptKey[0] = (0x261F261F); clif->cryptKey[1] = (0x261F261F); clif->cryptKey[2] = (0x261F261F); } while(0); + + + + do { clif->cryptKey[0] = (0x25733B31); clif->cryptKey[1] = (0x53486CFD); clif->cryptKey[2] = (0x398649BD); } while(0); + + + + do { clif->cryptKey[0] = (0x76052205); clif->cryptKey[1] = (0x22052205); clif->cryptKey[2] = (0x22052205); } while(0); + + + + do { clif->cryptKey[0] = (0x3F094C49); clif->cryptKey[1] = (0x55F86C1E); clif->cryptKey[2] = (0x58AA359A); } while(0); + + + + do { clif->cryptKey[0] = (0x75794A38); clif->cryptKey[1] = (0x58A96BC1); clif->cryptKey[2] = (0x296E6FB8); } while(0); + + + + do { clif->cryptKey[0] = (0x6948050B); clif->cryptKey[1] = (0x06511D9D); clif->cryptKey[2] = (0x725D4DF1); } while(0); + + + + do { clif->cryptKey[0] = (0x023A6C87); clif->cryptKey[1] = (0x14BF1F1E); clif->cryptKey[2] = (0x5CC70CC9); } while(0); + + + + do { clif->cryptKey[0] = (0x646E08D9); clif->cryptKey[1] = (0x5F153AB5); clif->cryptKey[2] = (0x61B509B5); } while(0); + + + + do { clif->cryptKey[0] = (0x6D166F66); clif->cryptKey[1] = (0x3C000FCF); clif->cryptKey[2] = (0x295B0FCB); } while(0); + + + + do { clif->cryptKey[0] = (0x434115DE); clif->cryptKey[1] = (0x34A10FE9); clif->cryptKey[2] = (0x6791428E); } while(0); + + + + do { clif->cryptKey[0] = (0x38F453EF); clif->cryptKey[1] = (0x6A040FD8); clif->cryptKey[2] = (0X65BD6668); } while(0); + + + + do { clif->cryptKey[0] = (0x4FF90E23); clif->cryptKey[1] = (0x0F1432F2); clif->cryptKey[2] = (0x4CFA1EDA); } while(0); + + + + do { clif->cryptKey[0] = (0x7E241DE0); clif->cryptKey[1] = (0x5E805580); clif->cryptKey[2] = (0x3D807D80); } while(0); + + + + do { clif->cryptKey[0] = (0x23A23148); clif->cryptKey[1] = (0x0C41420E); clif->cryptKey[2] = (0x53785AD7); } while(0); + + + + do { clif->cryptKey[0] = (0x6A596301); clif->cryptKey[1] = (0x76866D0E); clif->cryptKey[2] = (0x32294A45); } while(0); + + + + do { clif->cryptKey[0] = (0x631C511C); clif->cryptKey[1] = (0x111C111C); clif->cryptKey[2] = (0x111C111C); } while(0); + + + + do { clif->cryptKey[0] = (0x611B7097); clif->cryptKey[1] = (0x01F957A1); clif->cryptKey[2] = (0x768A0FCB); } while(0); + + + + + + do { clif->cryptKey[0] = (0x63224335); clif->cryptKey[1] = (0x0F3A1F27); clif->cryptKey[2] = (0x6D217B24); } while(0); + + + + do { clif->cryptKey[0] = (0x63DC7BDC); clif->cryptKey[1] = (0x7BDC7BDC); clif->cryptKey[2] = (0x7BDC7BDC); } while(0); + + + + do { clif->cryptKey[0] = (0x116763F2); clif->cryptKey[1] = (0x41117DAC); clif->cryptKey[2] = (0x7FD13C45); } while(0); + + + + do { clif->cryptKey[0] = (0x15D3271C); clif->cryptKey[1] = (0x004D725B); clif->cryptKey[2] = (0x111A3A37); } while(0); + + + + do { clif->cryptKey[0] = (0x04810281); clif->cryptKey[1] = (0x42814281); clif->cryptKey[2] = (0x42814281); } while(0); + + + + do { clif->cryptKey[0] = (0x2DFF467C); clif->cryptKey[1] = (0x444B37EE); clif->cryptKey[2] = (0x2C1B634F); } while(0); + + + + do { clif->cryptKey[0] = (0x290551EA); clif->cryptKey[1] = (0x2B952C75); clif->cryptKey[2] = (0x2D67669B); } while(0); + + + + + + do { clif->cryptKey[0] = (0x62C86D09); clif->cryptKey[1] = (0x75944F17); clif->cryptKey[2] = (0x112C133D); } while(0); +# 19038 "../../../server-code/src/map/clif.c" 2 + + +} +void clif_bc_ready(void) { + if( battle_config.display_status_timers ) + clif->status_change = clif_status_change; + else + clif->status_change = clif_status_change_notick; + + switch( battle_config.packet_obfuscation ) { + case 0: + clif->parse_cmd = clif_parse_cmd_normal; + break; + default: + case 1: + clif->parse_cmd = clif_parse_cmd_optional; + break; + case 2: + clif->parse_cmd = clif_parse_cmd_decrypt; + break; + } +} + + + +int do_init_clif( +# 19063 "../../../server-code/src/map/clif.c" 3 4 + _Bool +# 19063 "../../../server-code/src/map/clif.c" + minimal) +{ + if (minimal) + return 0; + + packetdb_loaddb(); + + sockt->set_defaultparse(clif->parse); + if (sockt->make_listen_bind(clif->bind_ip,clif->map_port) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),clif->map_port)); + exit( +# 19073 "../../../server-code/src/map/clif.c" 3 4 + 1 +# 19073 "../../../server-code/src/map/clif.c" + ); + } + + timer->add_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + timer->add_func_list(clif->delayquit, "clif_delayquit"); + + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); + + return 0; +} + +void do_final_clif(void) +{ + unsigned char i; + + ((clif->delay_clearunit_ers)->destroy(clif->delay_clearunit_ers)); + ((clif->delayed_damage_ers)->destroy(clif->delayed_damage_ers)); + + for(i = 0; i < CASHSHOP_TAB_MAX; i++) { + int k; + for( k = 0; k < clif->cs.item_count[i]; k++ ) { + (iMalloc->free((clif->cs.data[i][k]),"../../../server-code/src/map/clif.c", 19095, __func__)); + } + (iMalloc->free((clif->cs.data[i]),"../../../server-code/src/map/clif.c", 19097, __func__)); + } + + for(i = 0; i < 7; i++) { + if( clif->rd.nameid[i] ) + (iMalloc->free((clif->rd.nameid[i]),"../../../server-code/src/map/clif.c", 19102, __func__)); + if( clif->rd.qty[i] ) + (iMalloc->free((clif->rd.qty[i]),"../../../server-code/src/map/clif.c", 19104, __func__)); + } + +} +void clif_defaults(void) { + clif = &clif_s; + + clif->bind_ip = INADDR_ANY; + clif->map_port = 5121; + clif->ally_only = +# 19113 "../../../server-code/src/map/clif.c" 3 4 + 0 +# 19113 "../../../server-code/src/map/clif.c" + ; + clif->delayed_damage_ers = +# 19114 "../../../server-code/src/map/clif.c" 3 4 + ((void *)0) +# 19114 "../../../server-code/src/map/clif.c" + ; + + clif->init = do_init_clif; + clif->final = do_final_clif; + clif->setip = clif_setip; + clif->setbindip = clif_setbindip; + clif->setport = clif_setport; + clif->refresh_ip = clif_refresh_ip; + clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; + clif->parse = clif_parse; + clif->parse_cmd = clif_parse_cmd_optional; + clif->decrypt_cmd = clif_decrypt_cmd; + clif->packet = clif_packet; + + clif->authok = clif_authok; + clif->authrefuse = clif_authrefuse; + clif->authfail_fd = clif_authfail_fd; + clif->charselectok = clif_charselectok; + + clif->dropflooritem = clif_dropflooritem; + clif->clearflooritem = clif_clearflooritem; + clif->additem = clif_additem; + clif->dropitem = clif_dropitem; + clif->delitem = clif_delitem; + clif->takeitem = clif_takeitem; + clif->item_equip = clif_item_equip; + clif->item_normal = clif_item_normal; + clif->arrowequip = clif_arrowequip; + clif->arrow_fail = clif_arrow_fail; + clif->use_card = clif_use_card; + clif->cart_additem = clif_cart_additem; + clif->cart_delitem = clif_cart_delitem; + clif->equipitemack = clif_equipitemack; + clif->unequipitemack = clif_unequipitemack; + clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->addcards2 = clif_addcards2; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; + clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; + clif->item_drop_announce = clif_item_drop_announce; + + 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; + clif->changelook = clif_changelook; + clif->changetraplook = clif_changetraplook; + clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; + clif->class_change = clif_class_change; + 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->spawn_unit = clif_spawn_unit; + clif->spawn_unit2 = clif_spawn_unit2; + clif->set_unit_idle2 = clif_set_unit_idle2; + 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; + clif->graffiti_entry = clif_graffiti_entry; + + clif->spawn = clif_spawn; + + clif->changemap = clif_changemap; + clif->changemapcell = clif_changemapcell; + clif->map_property = clif_map_property; + clif->pvpset = clif_pvpset; + clif->map_property_mapall = clif_map_property_mapall; + clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; + clif->maptypeproperty2 = clif_maptypeproperty2; + + clif->changemapserver = clif_changemapserver; + + clif->npcbuysell = clif_npcbuysell; + 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; + + clif->scriptmes = clif_scriptmes; + clif->scriptnext = clif_scriptnext; + clif->scriptclose = clif_scriptclose; + clif->scriptmenu = clif_scriptmenu; + clif->scriptinput = clif_scriptinput; + clif->scriptinputstr = clif_scriptinputstr; + clif->cutin = clif_cutin; + clif->sendfakenpc = clif_sendfakenpc; + clif->scriptclear = clif_scriptclear; + + clif->viewpoint = clif_viewpoint; + clif->damage = clif_damage; + clif->sitting = clif_sitting; + clif->standing = clif_standing; + clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; + clif->refresh = clif_refresh; + clif->fame_blacksmith = clif_fame_blacksmith; + clif->fame_alchemist = clif_fame_alchemist; + clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; + clif->hotkeys = clif_hotkeys_send; + clif->insight = clif_insight; + clif->outsight = clif_outsight; + clif->skillcastcancel = clif_skillcastcancel; + clif->skill_fail = clif_skill_fail; + clif->skill_cooldown = clif_skill_cooldown; + clif->skill_memomessage = clif_skill_memomessage; + clif->skill_mapinfomessage = clif_skill_mapinfomessage; + clif->skill_produce_mix_list = clif_skill_produce_mix_list; + clif->cooking_list = clif_cooking_list; + clif->autospell = clif_autospell; + clif->combo_delay = clif_combo_delay; + clif->status_change = clif_status_change; + clif->insert_card = clif_insert_card; + 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; + clif->item_repair_list = clif_item_repair_list; + clif->item_repaireffect = clif_item_repaireffect; + clif->item_damaged = clif_item_damaged; + clif->item_refine_list = clif_item_refine_list; + clif->item_skill = clif_item_skill; + clif->mvp_item = clif_mvp_item; + clif->mvp_exp = clif_mvp_exp; + clif->mvp_noitem = clif_mvp_noitem; + 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; + clif->feel_req = clif_feel_req; + clif->starskill = clif_starskill; + clif->feel_info = clif_feel_info; + clif->hate_info = clif_hate_info; + clif->mission_info = clif_mission_info; + clif->feel_hate_reset = clif_feel_hate_reset; + clif->partytickack = clif_partytickack; + clif->equiptickack = clif_equiptickack; + clif->viewequip_ack = clif_viewequip_ack; + clif->equpcheckbox = clif_equpcheckbox; + clif->displayexp = clif_displayexp; + clif->font = clif_font; + clif->progressbar = clif_progressbar; + clif->progressbar_abort = clif_progressbar_abort; + clif->showdigit = clif_showdigit; + clif->elementalconverter_list = clif_elementalconverter_list; + clif->spellbook_list = clif_spellbook_list; + clif->magicdecoy_list = clif_magicdecoy_list; + clif->poison_list = clif_poison_list; + clif->autoshadowspell_list = clif_autoshadowspell_list; + clif->skill_itemlistwindow = clif_skill_itemlistwindow; + clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; + clif->initialstatus = clif_initialstatus; + clif->cooldown_list = clif_skill_cooldown_list; + + clif->updatestatus = clif_updatestatus; + clif->changestatus = clif_changestatus; + clif->statusupack = clif_statusupack; + 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; + + clif->misceffect = clif_misceffect; + clif->changeoption = clif_changeoption; + clif->changeoption2 = clif_changeoption2; + clif->emotion = clif_emotion; + clif->talkiebox = clif_talkiebox; + clif->wedding_effect = clif_wedding_effect; + clif->divorced = clif_divorced; + clif->callpartner = clif_callpartner; + clif->skill_damage = clif_skill_damage; + clif->skill_nodamage = clif_skill_nodamage; + clif->skill_poseffect = clif_skill_poseffect; + clif->skill_estimation = clif_skill_estimation; + clif->skill_warppoint = clif_skill_warppoint; + clif->skillcasting = clif_skillcasting; + 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; + clif->resurrection = clif_resurrection; + clif->refine = clif_refine; + clif->weather = clif_weather; + clif->specialeffect = clif_specialeffect; + clif->specialeffect_single = clif_specialeffect_single; + clif->specialeffect_value = clif_specialeffect_value; + clif->millenniumshield = clif_millenniumshield; + clif->spiritcharm = clif_charm; + clif->charm_single = clif_charm_single; + clif->snap = clif_snap; + clif->weather_check = clif_weather_check; + + clif->playBGM = clif_playBGM; + clif->soundeffect = clif_soundeffect; + clif->soundeffectall = clif_soundeffectall; + + clif->GlobalMessage = clif_GlobalMessage; + clif->createchat = clif_createchat; + clif->dispchat = clif_dispchat; + clif->joinchatfail = clif_joinchatfail; + clif->joinchatok = clif_joinchatok; + clif->addchat = clif_addchat; + clif->changechatowner = clif_changechatowner; + clif->clearchat = clif_clearchat; + clif->leavechat = clif_leavechat; + clif->changechatstatus = clif_changechatstatus; + clif->wis_message = clif_wis_message; + clif->wis_end = clif_wis_end; + clif->disp_message = clif_disp_message; + clif->broadcast = clif_broadcast; + clif->broadcast2 = clif_broadcast2; + clif->messagecolor_self = clif_messagecolor_self; + clif->messagecolor = clif_messagecolor; + clif->disp_overhead = clif_disp_overhead; + clif->msgtable_skill = clif_msgtable_skill; + clif->msgtable = clif_msgtable; + clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; + clif->messageln = clif_displaymessage2; + clif->messages = clif_displaymessage_sprintf; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; + clif->ShowScript = clif_ShowScript; + + clif->traderequest = clif_traderequest; + clif->tradestart = clif_tradestart; + clif->tradeadditem = clif_tradeadditem; + clif->tradeitemok = clif_tradeitemok; + clif->tradedeal_lock = clif_tradedeal_lock; + clif->tradecancelled = clif_tradecancelled; + clif->tradecompleted = clif_tradecompleted; + clif->tradeundo = clif_tradeundo; + + clif->openvendingreq = clif_openvendingreq; + clif->showvendingboard = clif_showvendingboard; + clif->closevendingboard = clif_closevendingboard; + clif->vendinglist = clif_vendinglist; + clif->buyvending = clif_buyvending; + clif->openvending = clif_openvending; + clif->vendingreport = clif_vendingreport; + + clif->storagelist = clif_storagelist; + clif->updatestorageamount = clif_updatestorageamount; + clif->storageitemadded = clif_storageitemadded; + clif->storageitemremoved = clif_storageitemremoved; + clif->storageclose = clif_storageclose; + + clif->skillinfoblock = clif_skillinfoblock; + clif->skillup = clif_skillup; + clif->skillinfo = clif_skillinfo; + clif->addskill = clif_addskill; + clif->deleteskill = clif_deleteskill; + + clif->party_created = clif_party_created; + clif->party_member_info = clif_party_member_info; + clif->party_info = clif_party_info; + clif->party_invite = clif_party_invite; + clif->party_inviteack = clif_party_inviteack; + clif->party_option = clif_party_option; + clif->party_withdraw = clif_party_withdraw; + clif->party_message = clif_party_message; + clif->party_xy = clif_party_xy; + clif->party_xy_single = clif_party_xy_single; + 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; + clif->PartyLeaderChanged = clif_PartyLeaderChanged; + + clif->guild_created = clif_guild_created; + clif->guild_belonginfo = clif_guild_belonginfo; + clif->guild_masterormember = clif_guild_masterormember; + clif->guild_basicinfo = clif_guild_basicinfo; + clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_memberlist = clif_guild_memberlist; + clif->guild_skillinfo = clif_guild_skillinfo; + clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; + clif->guild_memberlogin_notice = clif_guild_memberlogin_notice; + clif->guild_invite = clif_guild_invite; + clif->guild_inviteack = clif_guild_inviteack; + clif->guild_leave = clif_guild_leave; + clif->guild_expulsion = clif_guild_expulsion; + clif->guild_positionchanged = clif_guild_positionchanged; + clif->guild_memberpositionchanged = clif_guild_memberpositionchanged; + clif->guild_emblem = clif_guild_emblem; + clif->guild_emblem_area = clif_guild_emblem_area; + clif->guild_notice = clif_guild_notice; + clif->guild_message = clif_guild_message; + clif->guild_reqalliance = clif_guild_reqalliance; + clif->guild_allianceack = clif_guild_allianceack; + clif->guild_delalliance = clif_guild_delalliance; + clif->guild_oppositionack = clif_guild_oppositionack; + clif->guild_broken = clif_guild_broken; + 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; + + clif->bg_hp = clif_bg_hp; + clif->bg_xy = clif_bg_xy; + clif->bg_xy_remove = clif_bg_xy_remove; + clif->bg_message = clif_bg_message; + clif->bg_updatescore = clif_bg_updatescore; + clif->bg_updatescore_single = clif_bg_updatescore_single; + clif->sendbgemblem_area = clif_sendbgemblem_area; + clif->sendbgemblem_single = clif_sendbgemblem_single; + + clif->instance = clif_instance; + clif->instance_join = clif_instance_join; + clif->instance_leave = clif_instance_leave; + + clif->catch_process = clif_catch_process; + clif->pet_roulette = clif_pet_roulette; + clif->sendegg = clif_sendegg; + clif->send_petstatus = clif_send_petstatus; + clif->send_petdata = clif_send_petdata; + clif->pet_emotion = clif_pet_emotion; + clif->pet_food = clif_pet_food; + + 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; + + 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; + + clif->hominfo = clif_hominfo; + clif->homskillinfoblock = clif_homskillinfoblock; + clif->homskillup = clif_homskillup; + clif->hom_food = clif_hom_food; + clif->send_homdata = clif_send_homdata; + + clif->quest_send_list = clif_quest_send_list; + clif->quest_send_mission = clif_quest_send_mission; + clif->quest_add = clif_quest_add; + clif->quest_delete = clif_quest_delete; + clif->quest_update_status = clif_quest_update_status; + clif->quest_update_objective = clif_quest_update_objective; + clif->quest_show_event = clif_quest_show_event; + + clif->mail_window = clif_Mail_window; + clif->mail_read = clif_Mail_read; + clif->mail_delete = clif_Mail_delete; + clif->mail_return = clif_Mail_return; + clif->mail_send = clif_Mail_send; + clif->mail_new = clif_Mail_new; + clif->mail_refreshinbox = clif_Mail_refreshinbox; + clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; + + 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; + + clif->mercenary_info = clif_mercenary_info; + clif->mercenary_skillblock = clif_mercenary_skillblock; + clif->mercenary_message = clif_mercenary_message; + clif->mercenary_updatestatus = clif_mercenary_updatestatus; + + clif->rental_time = clif_rental_time; + clif->rental_expired = clif_rental_expired; + + clif->PartyBookingRegisterAck = clif_PartyBookingRegisterAck; + clif->PartyBookingDeleteAck = clif_PartyBookingDeleteAck; + clif->PartyBookingSearchAck = clif_PartyBookingSearchAck; + clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; + clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; + clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + clif->PartyRecruitRegisterAck = clif_PartyRecruitRegisterAck; + clif->PartyRecruitDeleteAck = clif_PartyRecruitDeleteAck; + clif->PartyRecruitSearchAck = clif_PartyRecruitSearchAck; + clif->PartyRecruitUpdateNotify = clif_PartyRecruitUpdateNotify; + clif->PartyRecruitDeleteNotify = clif_PartyRecruitDeleteNotify; + clif->PartyRecruitInsertNotify = clif_PartyRecruitInsertNotify; + + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; + + clif->buyingstore_open = clif_buyingstore_open; + clif->buyingstore_open_failed = clif_buyingstore_open_failed; + clif->buyingstore_myitemlist = clif_buyingstore_myitemlist; + clif->buyingstore_entry = clif_buyingstore_entry; + clif->buyingstore_entry_single = clif_buyingstore_entry_single; + clif->buyingstore_disappear_entry = clif_buyingstore_disappear_entry; + clif->buyingstore_disappear_entry_single = clif_buyingstore_disappear_entry_single; + clif->buyingstore_itemlist = clif_buyingstore_itemlist; + clif->buyingstore_trade_failed_buyer = clif_buyingstore_trade_failed_buyer; + clif->buyingstore_update_item = clif_buyingstore_update_item; + clif->buyingstore_delete_item = clif_buyingstore_delete_item; + clif->buyingstore_trade_failed_seller = clif_buyingstore_trade_failed_seller; + + clif->search_store_info_ack = clif_search_store_info_ack; + 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; + + clif->elemental_info = clif_elemental_info; + clif->elemental_updatestatus = clif_elemental_updatestatus; + + clif->bgqueue_ack = clif_bgqueue_ack; + clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; + clif->bgqueue_update_info = clif_bgqueue_update_info; + clif->bgqueue_joined = clif_bgqueue_joined; + clif->bgqueue_pcleft = clif_bgqueue_pcleft; + clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; + + clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; + clif->readbook = clif_readbook; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->bc_ready = clif_bc_ready; + + clif->channel_msg = clif_channel_msg; + clif->channel_msg2 = clif_channel_msg2; + + clif->undisguise_timer = clif_undisguise_timer; + + clif->bank_deposit = clif_bank_deposit; + clif->bank_withdraw = clif_bank_withdraw; + + clif->show_modifiers = clif_show_modifiers; + + clif->notify_bounditem = clif_notify_bounditem; + + clif->delay_damage = clif_delay_damage; + clif->delay_damage_sub = clif_delay_damage_sub; + + clif->npc_market_open = clif_npc_market_open; + clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; + + clif->parse_roulette_db = clif_parse_roulette_db; + clif->roulette_generate_ack = clif_roulette_generate_ack; + + clif->openmergeitem = clif_openmergeitem; + clif->cancelmergeitem = clif_cancelmergeitem; + clif->comparemergeitem = clif_comparemergeitem; + clif->ackmergeitems = clif_ackmergeitems; + + clif->selectcart = clif_selectcart; + + + + + 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->pSelectCart = clif_parse_SelectCart; + 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->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->pPartyRecruitRegisterReq = clif_parse_PartyRecruitRegisterReq; + clif->pPartyRecruitSearchReq = clif_parse_PartyRecruitSearchReq; + clif->pPartyRecruitDeleteReq = clif_parse_PartyRecruitDeleteReq; + clif->pPartyRecruitUpdateReq = clif_parse_PartyRecruitUpdateReq; + 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->pGMFullStrip = clif_parse_GMFullStrip; + 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; + + clif->pDull = clif_parse_dull; + + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; + + clif->pCashShopOpen = clif_parse_CashShopOpen; + clif->pCashShopClose = clif_parse_CashShopClose; + clif->pCashShopReqTab = clif_parse_CashShopReqTab; + clif->pCashShopSchedule = clif_parse_CashShopSchedule; + clif->pCashShopBuy = clif_parse_CashShopBuy; + + clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; + + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; + + clif->pBankDeposit = clif_parse_BankDeposit; + clif->pBankWithdraw = clif_parse_BankWithdraw; + clif->pBankCheck = clif_parse_BankCheck; + clif->pBankOpen = clif_parse_BankOpen; + clif->pBankClose = clif_parse_BankClose; + + clif->pRouletteOpen = clif_parse_RouletteOpen; + clif->pRouletteInfo = clif_parse_RouletteInfo; + clif->pRouletteClose = clif_parse_RouletteClose; + clif->pRouletteGenerate = clif_parse_RouletteGenerate; + clif->pRouletteRecvItem = clif_parse_RouletteRecvItem; + + clif->pNPCShopClosed = clif_parse_NPCShopClosed; + + clif->pNPCMarketClosed = clif_parse_NPCMarketClosed; + clif->pNPCMarketPurchase = clif_parse_NPCMarketPurchase; + + clif->add_random_options = clif_add_random_options; + clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; + clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; +} diff --git a/servergreps/hercules/20150805/src/login.c b/servergreps/hercules/20150805/src/login.c new file mode 100644 index 0000000..330a6e0 --- /dev/null +++ b/servergreps/hercules/20150805/src/login.c @@ -0,0 +1,9118 @@ +# 1 "../../../server-code/src/login/login.c" +# 1 "" +# 1 "" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 1 "" 2 +# 1 "../../../server-code/src/login/login.c" +# 23 "../../../server-code/src/login/login.c" +# 1 "../../../server-code/src/login/login.h" 1 +# 24 "../../../server-code/src/login/login.h" +# 1 "../../../server-code/src/common/hercules.h" 1 +# 23 "../../../server-code/src/common/hercules.h" +# 1 "../../../server-code/src/config/core.h" 1 +# 90 "../../../server-code/src/config/core.h" +# 1 "../../../server-code/src/config/./renewal.h" 1 +# 91 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./secure.h" 1 +# 92 "../../../server-code/src/config/core.h" 2 +# 1 "../../../server-code/src/config/./classes/general.h" 1 +# 93 "../../../server-code/src/config/core.h" 2 + + + + +# 1 "../../../server-code/src/config/./const.h" 1 +# 62 "../../../server-code/src/config/./const.h" + typedef short defType; +# 98 "../../../server-code/src/config/core.h" 2 +# 24 "../../../server-code/src/common/hercules.h" 2 +# 1 "../../../server-code/src/common/cbasetypes.h" 1 +# 116 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/inttypes.h" 1 3 4 +# 25 "/usr/include/inttypes.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 361 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 362 "/usr/include/features.h" 2 3 4 +# 385 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 386 "/usr/include/features.h" 2 3 4 +# 26 "/usr/include/inttypes.h" 2 3 4 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 1 3 4 +# 9 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 3 4 +# 1 "/usr/include/stdint.h" 1 3 4 +# 26 "/usr/include/stdint.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wchar.h" 1 3 4 +# 27 "/usr/include/stdint.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/stdint.h" 2 3 4 +# 36 "/usr/include/stdint.h" 3 4 + +# 36 "/usr/include/stdint.h" 3 4 +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; + +typedef long int int64_t; + + + + + + + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; + +typedef unsigned int uint32_t; + + + +typedef unsigned long int uint64_t; +# 65 "/usr/include/stdint.h" 3 4 +typedef signed char int_least8_t; +typedef short int int_least16_t; +typedef int int_least32_t; + +typedef long int int_least64_t; + + + + + + +typedef unsigned char uint_least8_t; +typedef unsigned short int uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef unsigned long int uint_least64_t; +# 90 "/usr/include/stdint.h" 3 4 +typedef signed char int_fast8_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +# 103 "/usr/include/stdint.h" 3 4 +typedef unsigned char uint_fast8_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +# 119 "/usr/include/stdint.h" 3 4 +typedef long int intptr_t; + + +typedef unsigned long int uintptr_t; +# 134 "/usr/include/stdint.h" 3 4 +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +# 10 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h" 2 3 4 +# 28 "/usr/include/inttypes.h" 2 3 4 + + + + + + +typedef int __gwchar_t; +# 266 "/usr/include/inttypes.h" 3 4 + + + + + +typedef struct + { + long int quot; + long int rem; + } imaxdiv_t; +# 290 "/usr/include/inttypes.h" 3 4 +extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern intmax_t strtoimax (const char *__restrict __nptr, + char **__restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t strtoumax (const char *__restrict __nptr, + char ** __restrict __endptr, int __base) __attribute__ ((__nothrow__ , __leaf__)); + + +extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr, + __gwchar_t **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr, + __gwchar_t ** __restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)); +# 432 "/usr/include/inttypes.h" 3 4 + +# 117 "../../../server-code/src/common/cbasetypes.h" 2 + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 34 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 1 3 4 + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 1 3 4 +# 168 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 3 4 +# 1 "/usr/include/limits.h" 1 3 4 +# 143 "/usr/include/limits.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 1 3 4 +# 160 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 1 3 4 +# 38 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 3 4 +# 1 "/usr/include/linux/limits.h" 1 3 4 +# 39 "/usr/include/x86_64-linux-gnu/bits/local_lim.h" 2 3 4 +# 161 "/usr/include/x86_64-linux-gnu/bits/posix1_lim.h" 2 3 4 +# 144 "/usr/include/limits.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/posix2_lim.h" 1 3 4 +# 148 "/usr/include/limits.h" 2 3 4 +# 169 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 8 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h" 2 3 4 +# 35 "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h" 2 3 4 +# 119 "../../../server-code/src/common/cbasetypes.h" 2 +# 1 "/usr/include/time.h" 1 3 4 +# 29 "/usr/include/time.h" 3 4 + + + + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 216 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 38 "/usr/include/time.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 42 "/usr/include/time.h" 2 3 4 +# 55 "/usr/include/time.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef __quad_t *__qaddr_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; +# 56 "/usr/include/time.h" 2 3 4 + + + +typedef __clock_t clock_t; + + + +# 73 "/usr/include/time.h" 3 4 + + +typedef __time_t time_t; + + + +# 91 "/usr/include/time.h" 3 4 +typedef __clockid_t clockid_t; +# 103 "/usr/include/time.h" 3 4 +typedef __timer_t timer_t; +# 120 "/usr/include/time.h" 3 4 +struct timespec + { + __time_t tv_sec; + __syscall_slong_t tv_nsec; + }; + + + + + + + + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + + + long int tm_gmtoff; + const char *tm_zone; + + + + +}; + + + + + + + + +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + + +struct sigevent; + + + + + +typedef __pid_t pid_t; +# 186 "/usr/include/time.h" 3 4 + + + +extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + +extern double difftime (time_t __time1, time_t __time0) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + +extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + +# 221 "/usr/include/time.h" 3 4 +# 1 "/usr/include/xlocale.h" 1 3 4 +# 27 "/usr/include/xlocale.h" 3 4 +typedef struct __locale_struct +{ + + struct __locale_data *__locales[13]; + + + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + + const char *__names[13]; +} *__locale_t; + + +typedef __locale_t locale_t; +# 222 "/usr/include/time.h" 2 3 4 + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)); +# 236 "/usr/include/time.h" 3 4 + + + +extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern char *__tzname[2]; +extern int __daylight; +extern long int __timezone; + + + + +extern char *tzname[2]; + + + +extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int daylight; +extern long int timezone; + + + + + +extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__)); +# 319 "/usr/include/time.h" 3 4 +extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 334 "/usr/include/time.h" 3 4 +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + + + +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); + + +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __attribute__ ((__nothrow__ , __leaf__)); + + +extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int timespec_get (struct timespec *__ts, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 430 "/usr/include/time.h" 3 4 + +# 120 "../../../server-code/src/common/cbasetypes.h" 2 +# 140 "../../../server-code/src/common/cbasetypes.h" + +# 140 "../../../server-code/src/common/cbasetypes.h" +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; +# 196 "../../../server-code/src/common/cbasetypes.h" +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 + +# 149 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef long int ptrdiff_t; +# 328 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef int wchar_t; +# 426 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 3 4 +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +# 211 "../../../server-code/src/common/cbasetypes.h" 2 +# 227 "../../../server-code/src/common/cbasetypes.h" + +# 227 "../../../server-code/src/common/cbasetypes.h" +typedef intptr_t intptr; +typedef uintptr_t uintptr; + + + + + + + + typedef int64 sysint; + typedef uint64 usysint; +# 305 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdbool.h" 1 3 4 +# 306 "../../../server-code/src/common/cbasetypes.h" 2 +# 395 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/include/ctype.h" 1 3 4 +# 28 "/usr/include/ctype.h" 3 4 + +# 39 "/usr/include/ctype.h" 3 4 +# 1 "/usr/include/endian.h" 1 3 4 +# 36 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/endian.h" 1 3 4 +# 37 "/usr/include/endian.h" 2 3 4 +# 60 "/usr/include/endian.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/byteswap-16.h" 1 3 4 +# 36 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 2 3 4 +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 + +# 44 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline unsigned int +__bswap_32 (unsigned int __bsx) +{ + return __builtin_bswap32 (__bsx); +} +# 108 "/usr/include/x86_64-linux-gnu/bits/byteswap.h" 3 4 +static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ + return __builtin_bswap64 (__bsx); +} +# 61 "/usr/include/endian.h" 2 3 4 +# 40 "/usr/include/ctype.h" 2 3 4 + + + + + + +enum +{ + _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)), + _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)), + _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)), + _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)), + _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)), + _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)), + _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)), + _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)), + _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)), + _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)), + _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)), + _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8)) +}; +# 79 "/usr/include/ctype.h" 3 4 +extern const unsigned short int **__ctype_b_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 104 "/usr/include/ctype.h" 3 4 + + + + + + +extern int isalnum (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit (int) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int tolower (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int toupper (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int isblank (int) __attribute__ ((__nothrow__ , __leaf__)); + + +# 150 "/usr/include/ctype.h" 3 4 +extern int isascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int toascii (int __c) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int _toupper (int) __attribute__ ((__nothrow__ , __leaf__)); +extern int _tolower (int) __attribute__ ((__nothrow__ , __leaf__)); +# 271 "/usr/include/ctype.h" 3 4 +extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); +extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + +extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); +# 347 "/usr/include/ctype.h" 3 4 + +# 396 "../../../server-code/src/common/cbasetypes.h" 2 +# 417 "../../../server-code/src/common/cbasetypes.h" +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 98 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h" 3 4 +typedef __gnuc_va_list va_list; +# 418 "../../../server-code/src/common/cbasetypes.h" 2 +# 25 "../../../server-code/src/common/hercules.h" 2 +# 25 "../../../server-code/src/login/login.h" 2 +# 1 "../../../server-code/src/common/core.h" 1 +# 25 "../../../server-code/src/common/core.h" +# 1 "../../../server-code/src/common/db.h" 1 +# 90 "../../../server-code/src/common/db.h" + +# 90 "../../../server-code/src/common/db.h" +enum DBReleaseOption { + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, +}; +# 117 "../../../server-code/src/common/db.h" +enum DBType { + DB_INT, + DB_UINT, + DB_STRING, + DB_ISTRING, + DB_INT64, + DB_UINT64, +}; +# 148 "../../../server-code/src/common/db.h" +enum DBOptions { + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, +}; +# 169 "../../../server-code/src/common/db.h" +union DBKey { + int i; + unsigned int ui; + const char *str; + char *mutstr; + int64 i64; + uint64 ui64; +}; +# 186 "../../../server-code/src/common/db.h" +enum DBDataType { + DB_DATA_INT, + DB_DATA_UINT, + DB_DATA_PTR, +}; +# 201 "../../../server-code/src/common/db.h" +struct DBData { + enum DBDataType type; + union { + int i; + unsigned int ui; + void *ptr; + } u; +}; +# 220 "../../../server-code/src/common/db.h" +typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); +# 237 "../../../server-code/src/common/db.h" +typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); +# 250 "../../../server-code/src/common/db.h" +typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); +# 264 "../../../server-code/src/common/db.h" +typedef int (*DBComparator)(union DBKey key1, union DBKey key2, unsigned short maxlen); +# 276 "../../../server-code/src/common/db.h" +typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); +# 290 "../../../server-code/src/common/db.h" +typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); +# 304 "../../../server-code/src/common/db.h" +struct DBIterator { +# 314 "../../../server-code/src/common/db.h" + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); +# 325 "../../../server-code/src/common/db.h" + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); +# 336 "../../../server-code/src/common/db.h" + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); +# 347 "../../../server-code/src/common/db.h" + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); +# 357 "../../../server-code/src/common/db.h" + +# 357 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 357 "../../../server-code/src/common/db.h" + (*exists)(struct DBIterator *self); +# 372 "../../../server-code/src/common/db.h" + int (*remove)(struct DBIterator *self, struct DBData *out_data); + + + + + + + void (*destroy)(struct DBIterator *self); + +}; + + + + + + + +struct DBMap { +# 400 "../../../server-code/src/common/db.h" + struct DBIterator *(*iterator)(struct DBMap *self); +# 409 "../../../server-code/src/common/db.h" + +# 409 "../../../server-code/src/common/db.h" 3 4 +_Bool +# 409 "../../../server-code/src/common/db.h" + (*exists)(struct DBMap *self, union DBKey key); +# 418 "../../../server-code/src/common/db.h" + struct DBData *(*get)(struct DBMap *self, union DBKey key); +# 438 "../../../server-code/src/common/db.h" + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); +# 456 "../../../server-code/src/common/db.h" + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); +# 472 "../../../server-code/src/common/db.h" + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); +# 486 "../../../server-code/src/common/db.h" + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); +# 499 "../../../server-code/src/common/db.h" + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); +# 511 "../../../server-code/src/common/db.h" + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); +# 525 "../../../server-code/src/common/db.h" + int (*foreach)(struct DBMap *self, DBApply func, ...); +# 537 "../../../server-code/src/common/db.h" + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); +# 553 "../../../server-code/src/common/db.h" + int (*clear)(struct DBMap *self, DBApply func, ...); +# 567 "../../../server-code/src/common/db.h" + int (*vclear)(struct DBMap *self, DBApply func, va_list args); +# 584 "../../../server-code/src/common/db.h" + int (*destroy)(struct DBMap *self, DBApply func, ...); +# 599 "../../../server-code/src/common/db.h" + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); + + + + + + + + unsigned int (*size)(struct DBMap *self); + + + + + + + + enum DBType (*type)(struct DBMap *self); + + + + + + + + enum DBOptions (*options)(struct DBMap *self); + +}; +# 745 "../../../server-code/src/common/db.h" +struct db_interface { +# 758 "../../../server-code/src/common/db.h" +enum DBOptions (*fix_options) (enum DBType type, enum DBOptions options); +# 768 "../../../server-code/src/common/db.h" +DBComparator (*default_cmp) (enum DBType type); +# 778 "../../../server-code/src/common/db.h" +DBHasher (*default_hash) (enum DBType type); +# 797 "../../../server-code/src/common/db.h" +DBReleaser (*default_release) (enum DBType type, enum DBOptions options); +# 808 "../../../server-code/src/common/db.h" +DBReleaser (*custom_release) (enum DBReleaseOption which); +# 834 "../../../server-code/src/common/db.h" +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); + + + + + + + +union DBKey (*i2key) (int key); + + + + + + + +union DBKey (*ui2key) (unsigned int key); + + + + + + + +union DBKey (*str2key) (const char *key); + + + + + + + +union DBKey (*i642key) (int64 key); + + + + + + + +union DBKey (*ui642key) (uint64 key); + + + + + + + +struct DBData (*i2data) (int data); + + + + + + + +struct DBData (*ui2data) (unsigned int data); + + + + + + + +struct DBData (*ptr2data) (void *data); +# 907 "../../../server-code/src/common/db.h" +int (*data2i) (struct DBData *data); +# 916 "../../../server-code/src/common/db.h" +unsigned int (*data2ui) (struct DBData *data); +# 925 "../../../server-code/src/common/db.h" +void* (*data2ptr) (struct DBData *data); + + + + + + +void (*init) (void); + + + + + + + +void (*final) (void); +}; + + +struct linkdb_node { + struct linkdb_node *next; + struct linkdb_node *prev; + void *key; + void *data; +}; + +typedef void (*LinkDBFunc)(void* key, void* data, va_list args); + + +void linkdb_insert (struct linkdb_node** head, void *key, void* data); +void linkdb_replace (struct linkdb_node** head, void *key, void* data); +void* linkdb_search (struct linkdb_node** head, void *key); +void* linkdb_erase (struct linkdb_node** head, void *key); +void linkdb_final (struct linkdb_node** head); +void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); +void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); + +void db_defaults(void); + + +extern struct db_interface *DB; +# 26 "../../../server-code/src/common/core.h" 2 +# 34 "../../../server-code/src/common/core.h" +enum server_types { + SERVER_TYPE_UNKNOWN = 0x0, + SERVER_TYPE_LOGIN = 0x1, + SERVER_TYPE_CHAR = 0x2, + SERVER_TYPE_MAP = 0x4, +}; + + +enum E_CORE_ST { + CORE_ST_STOP = 0, + CORE_ST_RUN, + CORE_ST_LAST +}; + + +enum cmdline_options { + CMDLINE_OPT_NORMAL = 0x0, + CMDLINE_OPT_PARAM = 0x1, + CMDLINE_OPT_SILENT = 0x2, + CMDLINE_OPT_PREINIT = 0x4, +}; +typedef +# 55 "../../../server-code/src/common/core.h" 3 4 + _Bool +# 55 "../../../server-code/src/common/core.h" + (*CmdlineExecFunc)(const char *name, const char *params); +struct CmdlineArgData { + unsigned int pluginID; + unsigned int options; + char *name; + char shortname; + CmdlineExecFunc func; + char *help; +}; + +struct cmdline_interface { + struct { int _max_; int _len_; struct CmdlineArgData *_data_; } args_data; + + void (*init) (void); + void (*final) (void); + +# 70 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 70 "../../../server-code/src/common/core.h" + (*arg_add) (unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options); + int (*exec) (int argc, char **argv, unsigned int options); + +# 72 "../../../server-code/src/common/core.h" 3 4 +_Bool +# 72 "../../../server-code/src/common/core.h" + (*arg_next_value) (const char *name, int current_arg, int argc); + const char *(*arg_source) (struct CmdlineArgData *arg); +}; + +struct core_interface { + int arg_c; + char **arg_v; + + int runflag; + char *server_name; + enum server_types server_type; + + + + void (*shutdown_callback)(void); +}; + + + + + + +extern void cmdline_args_init_local(void); +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + + + + + + + +void cmdline_defaults(void); + + +extern struct core_interface *core; +extern struct cmdline_interface *cmdline; +# 26 "../../../server-code/src/login/login.h" 2 + +# 1 "../../../server-code/src/common/mmo.h" 1 +# 225 "../../../server-code/src/common/mmo.h" +struct hplugin_data_store; + +enum item_types { + IT_HEALING = 0, + IT_UNKNOWN, + IT_USABLE, + IT_ETC, + IT_WEAPON, + IT_ARMOR, + IT_CARD, + IT_PETEGG, + IT_PETARMOR, + IT_UNKNOWN2, + IT_AMMO, + IT_DELAYCONSUME, + IT_CASH = 18, + IT_MAX +}; + + + + +enum quest_state { + Q_INACTIVE, + Q_ACTIVE, + Q_COMPLETE, +}; + + +struct quest { + int quest_id; + unsigned int time; + int count[3]; + enum quest_state state; +}; + +struct item { + int id; + short nameid; + short amount; + unsigned int equip; + char identify; + char refine; + char attribute; + short card[4]; + unsigned int expire_time; + char favorite; + unsigned char bound; + uint64 unique_id; +}; + + +enum equip_pos { + EQP_NONE = 0x000000, + EQP_HEAD_LOW = 0x000001, + EQP_HEAD_MID = 0x000200, + EQP_HEAD_TOP = 0x000100, + EQP_HAND_R = 0x000002, + EQP_HAND_L = 0x000020, + EQP_ARMOR = 0x000010, + EQP_SHOES = 0x000040, + EQP_GARMENT = 0x000004, + EQP_ACC_L = 0x000008, + EQP_ACC_R = 0x000080, + EQP_COSTUME_HEAD_TOP = 0x000400, + EQP_COSTUME_HEAD_MID = 0x000800, + EQP_COSTUME_HEAD_LOW = 0x001000, + EQP_COSTUME_GARMENT = 0x002000, + + EQP_AMMO = 0x008000, + EQP_SHADOW_ARMOR = 0x010000, + EQP_SHADOW_WEAPON = 0x020000, + EQP_SHADOW_SHIELD = 0x040000, + EQP_SHADOW_SHOES = 0x080000, + EQP_SHADOW_ACC_R = 0x100000, + EQP_SHADOW_ACC_L = 0x200000, +}; + +struct point { + unsigned short map; + short x,y; +}; + +enum e_skill_flag +{ + SKILL_FLAG_PERMANENT, + SKILL_FLAG_TEMPORARY, + SKILL_FLAG_PLAGIARIZED, + SKILL_FLAG_UNUSED, + SKILL_FLAG_PERM_GRANTED, + + + SKILL_FLAG_REPLACED_LV_0, +}; + +enum e_mmo_charstatus_opt { + OPT_NONE = 0x0, + OPT_SHOW_EQUIP = 0x1, + OPT_ALLOW_PARTY = 0x2, +}; + +enum e_item_bound_type { + IBT_NONE = 0x0, + IBT_MIN = 0x1, + IBT_ACCOUNT = 0x1, + IBT_GUILD = 0x2, + IBT_PARTY = 0x3, + IBT_CHARACTER = 0x4, + IBT_MAX = 0x4, +}; + +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, +# 372 "../../../server-code/src/common/mmo.h" + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + +struct s_skill { + unsigned short id; + unsigned char lv; + unsigned char flag; +}; + +struct script_reg_state { + unsigned int type : 1; + unsigned int update : 1; +}; + +struct script_reg_num { + struct script_reg_state flag; + int value; +}; + +struct script_reg_str { + struct script_reg_state flag; + char *value; +}; + + +struct status_change_data { + unsigned short type; + int val1, val2, val3, val4; + int tick; +}; + +struct storage_data { + int storage_amount; + struct item items[600]; +}; + +struct guild_storage { + int dirty; + int guild_id; + short storage_status; + short storage_amount; + struct item items[600]; + unsigned short lock; +}; + +struct s_pet { + int account_id; + int char_id; + int pet_id; + short class_; + short level; + short egg_id; + short equip; + short intimate; + short hungry; + char name[(23 + 1)]; + char rename_flag; + char incubate; +}; + +struct s_homunculus { + char name[(23 + 1)]; + int hom_id; + int char_id; + short class_; + short prev_class; + int hp,max_hp,sp,max_sp; + unsigned int intimacy; + short hunger; + struct s_skill hskill[43]; + short skillpts; + short level; + unsigned int exp; + short rename_flag; + short vaporize; + int str; + int agi; + int vit; + int int_; + int dex; + int luk; + + int str_value; + int agi_value; + int vit_value; + int int_value; + int dex_value; + int luk_value; + + int8 spiritball; +}; + +struct s_mercenary { + int mercenary_id; + int char_id; + short class_; + int hp, sp; + unsigned int kill_count; + unsigned int life_time; +}; + +struct s_elemental { + int elemental_id; + int char_id; + short class_; + uint32 mode; + int hp, sp, max_hp, max_sp, matk, atk, atk2; + short hit, flee, amotion, def, mdef; + int life_time; +}; + +struct s_friend { + int account_id; + int char_id; + char name[(23 + 1)]; +}; + +struct hotkey { + + unsigned int id; + unsigned short lv; + unsigned char type; + + + +}; + +struct mmo_charstatus { + int char_id; + int account_id; + int partner_id; + int father; + int mother; + int child; + + unsigned int base_exp,job_exp; + int zeny; + int bank_vault; + + short class_; + unsigned int status_point,skill_point; + int hp,max_hp,sp,max_sp; + unsigned int option; + short manner; + unsigned char karma; + short hair,hair_color,clothes_color,body; + int party_id,guild_id,pet_id,hom_id,mer_id,ele_id; + int fame; + + + int arch_faith, arch_calls; + int spear_faith, spear_calls; + int sword_faith, sword_calls; + + short weapon; + short shield; + short head_top,head_mid,head_bottom; + short robe; + + char name[(23 + 1)]; + unsigned int base_level,job_level; + short str,agi,vit,int_,dex,luk; + unsigned char slot,sex; + + uint32 mapip; + uint16 mapport; + + struct point last_point,save_point,memo_point[3]; + struct item inventory[100],cart[100]; + struct storage_data storage; + struct s_skill skill[1478]; + + struct s_friend friends[40]; + + struct hotkey hotkeys[38]; + + +# 549 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 549 "../../../server-code/src/common/mmo.h" + show_equip, allow_party; + unsigned short rename; + unsigned short slotchange; + + time_t delete_date; + + + unsigned short mod_exp,mod_drop,mod_death; + + unsigned char font; + + uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; +}; + +typedef enum mail_status { + MAIL_NEW, + MAIL_UNREAD, + MAIL_READ, +} mail_status; + +struct mail_message { + int id; + int send_id; + char send_name[(23 + 1)]; + int dest_id; + char dest_name[(23 + 1)]; + char title[40]; + char body[200]; + + mail_status status; + time_t timestamp; + + int zeny; + struct item item; +}; + +struct mail_data { + short amount; + +# 589 "../../../server-code/src/common/mmo.h" 3 4 +_Bool +# 589 "../../../server-code/src/common/mmo.h" + full; + short unchecked, unread; + struct mail_message msg[30]; +}; + +struct auction_data { + unsigned int auction_id; + int seller_id; + char seller_name[(23 + 1)]; + int buyer_id; + char buyer_name[(23 + 1)]; + + struct item item; + + char item_name[50]; + short type; + + unsigned short hours; + int price, buynow; + time_t timestamp; + int auction_end_timer; +}; + +struct party_member { + int account_id; + int char_id; + char name[(23 + 1)]; + unsigned short class_; + unsigned short map; + unsigned short lv; + unsigned leader : 1, + online : 1; +}; + +struct party { + int party_id; + char name[(23 + 1)]; + unsigned char count; + unsigned exp : 1, + item : 2; + struct party_member member[12]; +}; + +struct map_session_data; +struct guild_member { + int account_id, char_id; + short hair,hair_color,gender,class_,lv; + uint64 exp; + int exp_payper; + short online,position; + char name[(23 + 1)]; + struct map_session_data *sd; + unsigned char modified; +}; + +struct guild_position { + char name[(23 + 1)]; + int mode; + int exp_mode; + unsigned char modified; +}; + +struct guild_alliance { + int opposition; + int guild_id; + char name[(23 + 1)]; +}; + +struct guild_expulsion { + char name[(23 + 1)]; + char mes[40]; + int account_id; +}; + +struct guild_skill { + int id,lv; +}; + +struct channel_data; +struct guild { + int guild_id; + short guild_lv, connect_member, max_member, average_lv; + uint64 exp; + unsigned int next_exp; + int skill_point; + char name[(23 + 1)],master[(23 + 1)]; + struct guild_member member[(16 +10*6)]; + struct guild_position position[20]; + char mes1[60],mes2[120]; + int emblem_len,emblem_id; + char emblem_data[2048]; + struct guild_alliance alliance[16]; + struct guild_expulsion expulsion[32]; + struct guild_skill skill[15]; + + + unsigned short save_flag; + + short *instance; + unsigned short instances; + + struct channel_data *channel; + struct hplugin_data_store *hdata; +}; + +struct guild_castle { + int castle_id; + int mapindex; + char castle_name[(23 + 1)]; + char castle_event[(23 + 1)]; + int guild_id; + int economy; + int defense; + int triggerE; + int triggerD; + int nextTime; + int payTime; + int createTime; + int visibleC; + struct { + unsigned visible : 1; + int id; + } guardian[8]; + int* temp_guardians; + int temp_guardians_max; +}; + +struct fame_list { + int id; + int fame; + char name[(23 + 1)]; +}; + +enum fame_list_type { + RANKTYPE_BLACKSMITH = 0, + RANKTYPE_ALCHEMIST = 1, + RANKTYPE_TAEKWON = 2, + RANKTYPE_PK = 3, +}; + + + + + + +enum guild_basic_info { + GBI_EXP = 1, + GBI_GUILDLV, + GBI_SKILLPOINT, + + + + + + GBI_SKILLLV, +}; + +enum { + GMI_POSITION = 0, + GMI_EXP, + GMI_HAIR, + GMI_HAIR_COLOR, + GMI_GENDER, + GMI_CLASS, + GMI_LEVEL, +}; + +enum guild_permission { + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_ALL = GPERM_INVITE|GPERM_EXPEL, + GPERM_MASK = GPERM_ALL, +}; + +enum { + GD_SKILLBASE=10000, + GD_APPROVAL=10000, + GD_KAFRACONTRACT=10001, + GD_GUARDRESEARCH=10002, + GD_GUARDUP=10003, + GD_EXTENSION=10004, + GD_GLORYGUILD=10005, + GD_LEADERSHIP=10006, + GD_GLORYWOUNDS=10007, + GD_SOULCOLD=10008, + GD_HAWKEYES=10009, + GD_BATTLEORDER=10010, + GD_REGENERATION=10011, + GD_RESTORE=10012, + GD_EMERGENCYCALL=10013, + GD_DEVELOPMENT=10014, + GD_MAX, +}; + + +enum { + JOB_NOVICE, + JOB_SWORDMAN, + JOB_MAGE, + JOB_ARCHER, + JOB_ACOLYTE, + JOB_MERCHANT, + JOB_THIEF, + JOB_KNIGHT, + JOB_PRIEST, + JOB_WIZARD, + JOB_BLACKSMITH, + JOB_HUNTER, + JOB_ASSASSIN, + JOB_KNIGHT2, + JOB_CRUSADER, + JOB_MONK, + JOB_SAGE, + JOB_ROGUE, + JOB_ALCHEMIST, + JOB_BARD, + JOB_DANCER, + JOB_CRUSADER2, + JOB_WEDDING, + JOB_SUPER_NOVICE, + JOB_GUNSLINGER, + JOB_NINJA, + JOB_XMAS, + JOB_SUMMER, + JOB_MAX_BASIC, + + JOB_NOVICE_HIGH = 4001, + JOB_SWORDMAN_HIGH, + JOB_MAGE_HIGH, + JOB_ARCHER_HIGH, + JOB_ACOLYTE_HIGH, + JOB_MERCHANT_HIGH, + JOB_THIEF_HIGH, + JOB_LORD_KNIGHT, + JOB_HIGH_PRIEST, + JOB_HIGH_WIZARD, + JOB_WHITESMITH, + JOB_SNIPER, + JOB_ASSASSIN_CROSS, + JOB_LORD_KNIGHT2, + JOB_PALADIN, + JOB_CHAMPION, + JOB_PROFESSOR, + JOB_STALKER, + JOB_CREATOR, + JOB_CLOWN, + JOB_GYPSY, + JOB_PALADIN2, + + JOB_BABY, + JOB_BABY_SWORDMAN, + JOB_BABY_MAGE, + JOB_BABY_ARCHER, + JOB_BABY_ACOLYTE, + JOB_BABY_MERCHANT, + JOB_BABY_THIEF, + JOB_BABY_KNIGHT, + JOB_BABY_PRIEST, + JOB_BABY_WIZARD, + JOB_BABY_BLACKSMITH, + JOB_BABY_HUNTER, + JOB_BABY_ASSASSIN, + JOB_BABY_KNIGHT2, + JOB_BABY_CRUSADER, + JOB_BABY_MONK, + JOB_BABY_SAGE, + JOB_BABY_ROGUE, + JOB_BABY_ALCHEMIST, + JOB_BABY_BARD, + JOB_BABY_DANCER, + JOB_BABY_CRUSADER2, + JOB_SUPER_BABY, + + JOB_TAEKWON, + JOB_STAR_GLADIATOR, + JOB_STAR_GLADIATOR2, + JOB_SOUL_LINKER, + + JOB_GANGSI, + JOB_DEATH_KNIGHT, + JOB_DARK_COLLECTOR, + + JOB_RUNE_KNIGHT = 4054, + JOB_WARLOCK, + JOB_RANGER, + JOB_ARCH_BISHOP, + JOB_MECHANIC, + JOB_GUILLOTINE_CROSS, + + JOB_RUNE_KNIGHT_T, + JOB_WARLOCK_T, + JOB_RANGER_T, + JOB_ARCH_BISHOP_T, + JOB_MECHANIC_T, + JOB_GUILLOTINE_CROSS_T, + + JOB_ROYAL_GUARD, + JOB_SORCERER, + JOB_MINSTREL, + JOB_WANDERER, + JOB_SURA, + JOB_GENETIC, + JOB_SHADOW_CHASER, + + JOB_ROYAL_GUARD_T, + JOB_SORCERER_T, + JOB_MINSTREL_T, + JOB_WANDERER_T, + JOB_SURA_T, + JOB_GENETIC_T, + JOB_SHADOW_CHASER_T, + + JOB_RUNE_KNIGHT2, + JOB_RUNE_KNIGHT_T2, + JOB_ROYAL_GUARD2, + JOB_ROYAL_GUARD_T2, + JOB_RANGER2, + JOB_RANGER_T2, + JOB_MECHANIC2, + JOB_MECHANIC_T2, + + JOB_BABY_RUNE = 4096, + JOB_BABY_WARLOCK, + JOB_BABY_RANGER, + JOB_BABY_BISHOP, + JOB_BABY_MECHANIC, + JOB_BABY_CROSS, + + JOB_BABY_GUARD, + JOB_BABY_SORCERER, + JOB_BABY_MINSTREL, + JOB_BABY_WANDERER, + JOB_BABY_SURA, + JOB_BABY_GENETIC, + JOB_BABY_CHASER, + + JOB_BABY_RUNE2, + JOB_BABY_GUARD2, + JOB_BABY_RANGER2, + JOB_BABY_MECHANIC2, + + JOB_SUPER_NOVICE_E = 4190, + JOB_SUPER_BABY_E, + + JOB_KAGEROU = 4211, + JOB_OBORO, + JOB_REBELLION = 4215, + + JOB_MAX, +}; + + + + +enum { + SEX_FEMALE = 0, + SEX_MALE, + SEX_SERVER +}; + +enum weapon_type { + W_FIST, + W_DAGGER, + W_1HSWORD, + W_2HSWORD, + W_1HSPEAR, + W_2HSPEAR, + W_1HAXE, + W_2HAXE, + W_MACE, + W_2HMACE, + W_STAFF, + W_BOW, + W_KNUCKLE, + W_MUSICAL, + W_WHIP, + W_BOOK, + W_KATAR, + W_REVOLVER, + W_RIFLE, + W_GATLING, + W_SHOTGUN, + W_GRENADE, + W_HUUMA, + W_2HSTAFF, + MAX_SINGLE_WEAPON_TYPE, + + W_DOUBLE_DD, + W_DOUBLE_SS, + W_DOUBLE_AA, + W_DOUBLE_DS, + W_DOUBLE_DA, + W_DOUBLE_SA, + MAX_WEAPON_TYPE, +}; + +enum ammo_type { + A_ARROW = 1, + A_DAGGER, + A_BULLET, + A_SHELL, + A_GRENADE, + A_SHURIKEN, + A_KUNAI, + A_CANNONBALL, + A_THROWWEAPON, +}; + +enum e_char_server_type { + CST_NORMAL = 0, + CST_MAINTENANCE = 1, + CST_OVER18 = 2, + CST_PAYING = 3, + CST_F2P = 4, +}; + +enum e_pc_reg_loading { + PRL_NONE = 0x0, + PRL_CHAR = 0x1, + PRL_ACCL = 0x2, + PRL_ACCG = 0x4, + PRL_ALL = 0xFF, +}; + + + + +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, + CHAR_ASK_NAME_BAN = 2, + CHAR_ASK_NAME_UNBLOCK = 3, + CHAR_ASK_NAME_UNBAN = 4, + CHAR_ASK_NAME_CHANGESEX = 5, + CHAR_ASK_NAME_CHARBAN = 6, + CHAR_ASK_NAME_CHARUNBAN = 7, + CHAR_ASK_NAME_CHANGECHARSEX = 8, +}; + + + + +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, + CHAR_ASK_NAME_ANS_NOTFOUND = 1, + CHAR_ASK_NAME_ANS_GMLOW = 2, + CHAR_ASK_NAME_ANS_OFFLINE = 3, +}; +# 28 "../../../server-code/src/login/login.h" 2 + +struct mmo_account; +struct AccountDB; + +enum E_LOGINSERVER_ST +{ + LOGINSERVER_ST_RUNNING = CORE_ST_LAST, + LOGINSERVER_ST_SHUTDOWN, + LOGINSERVER_ST_LAST +}; + +enum password_enc { + PWENC_NONE = 0x0, + PWENC_ENCRYPT = 0x1, + PWENC_ENCRYPT2 = 0x2, + PWENC_BOTH = PWENC_ENCRYPT|PWENC_ENCRYPT2, +}; + + + + + +struct login_session_data { + int account_id; + int login_id1; + int login_id2; + char sex; + + char userid[(23 + 1)]; + char passwd[(32+1)]; + int passwdenc; + char md5key[20]; + uint16 md5keylen; + + char lastlogin[24]; + uint8 group_id; + uint8 clienttype; + uint32 version; + + uint8 client_hash[16]; + int has_client_hash; + + int fd; + + time_t expiration_time; +}; + +struct mmo_char_server { + + char name[20]; + int fd; + uint32 ip; + uint16 port; + uint16 users; + uint16 type; + uint16 new_; +}; + +struct client_hash_node { + int group_id; + uint8 hash[16]; + struct client_hash_node *next; +}; + +struct Login_Config { + + uint32 login_ip; + uint16 login_port; + unsigned int ipban_cleanup_interval; + unsigned int ip_sync_interval; + +# 98 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 98 "../../../server-code/src/login/login.h" + log_login; + char date_format[32]; + +# 100 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 100 "../../../server-code/src/login/login.h" + new_account_flag,new_acc_length_limit; + int start_limited_time; + +# 102 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 102 "../../../server-code/src/login/login.h" + use_md5_passwds; + int group_id_to_connect; + int min_group_id_to_connect; + +# 105 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/login.h" + check_client_version; + uint32 client_version_to_connect; + int allowed_regs; + int time_allowed; + + +# 110 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 110 "../../../server-code/src/login/login.h" + ipban; + +# 111 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 111 "../../../server-code/src/login/login.h" + dynamic_pass_failure_ban; + unsigned int dynamic_pass_failure_ban_interval; + unsigned int dynamic_pass_failure_ban_limit; + unsigned int dynamic_pass_failure_ban_duration; + +# 115 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 115 "../../../server-code/src/login/login.h" + use_dnsbl; + char dnsbl_servs[1024]; + + int client_hash_check; + struct client_hash_node *client_hash_nodes; +}; + +struct login_auth_node { + int account_id; + uint32 login_id1; + uint32 login_id2; + uint32 ip; + char sex; + uint32 version; + uint8 clienttype; + int group_id; + time_t expiration_time; +}; + + + + +struct online_login_data { + int account_id; + int waiting_disconnect; + int char_server; +}; +# 151 "../../../server-code/src/login/login.h" +struct login_interface { + struct DBMap *auth_db; + struct DBMap *online_db; + int fd; + struct Login_Config *config; + struct AccountDB* accounts; + + int (*mmo_auth) (struct login_session_data* sd, +# 158 "../../../server-code/src/login/login.h" 3 4 + _Bool +# 158 "../../../server-code/src/login/login.h" + isServer); + int (*mmo_auth_new) (const char* userid, const char* pass, const char sex, const char* last_ip); + int (*waiting_disconnect_timer) (int tid, int64 tick, int id, intptr_t data); + struct DBData (*create_online_user) (union DBKey key, va_list args); + struct online_login_data* (*add_online_user) (int char_server, int account_id); + void (*remove_online_user) (int account_id); + int (*online_db_setoffline) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + int (*sync_ip_addresses) (int tid, int64 tick, int id, intptr_t data); + +# 168 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 168 "../../../server-code/src/login/login.h" + (*check_encrypted) (const char* str1, const char* str2, const char* passwd); + +# 169 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 169 "../../../server-code/src/login/login.h" + (*check_password) (const char* md5key, int passwdenc, const char* passwd, const char* refpass); + uint32 (*lan_subnet_check) (uint32 ip); + void (*fromchar_accinfo) (int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc); + void (*fromchar_account) (int fd, int account_id, struct mmo_account *acc); + void (*fromchar_account_update_other) (int account_id, unsigned int state); + void (*fromchar_auth_ack) (int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node); + void (*fromchar_ban) (int account_id, time_t timestamp); + void (*fromchar_change_sex_other) (int account_id, char sex); + void (*fromchar_pong) (int fd); + void (*fromchar_parse_auth) (int fd, int id, const char *ip); + void (*fromchar_parse_update_users) (int fd, int id); + void (*fromchar_parse_request_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_data) (int fd, int id, const char *ip); + void (*fromchar_parse_ping) (int fd); + void (*fromchar_parse_change_email) (int fd, int id, const char *ip); + void (*fromchar_parse_account_update) (int fd, int id, const char *ip); + void (*fromchar_parse_ban) (int fd, int id, const char *ip); + void (*fromchar_parse_change_sex) (int fd, int id, const char *ip); + void (*fromchar_parse_account_reg2) (int fd, int id, const char *ip); + void (*fromchar_parse_unban) (int fd, int id, const char *ip); + void (*fromchar_parse_account_online) (int fd, int id); + void (*fromchar_parse_account_offline) (int fd); + void (*fromchar_parse_online_accounts) (int fd, int id); + void (*fromchar_parse_request_account_reg2) (int fd); + void (*fromchar_parse_update_wan_ip) (int fd, int id); + void (*fromchar_parse_all_offline) (int fd, int id); + void (*fromchar_parse_change_pincode) (int fd); + +# 196 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 196 "../../../server-code/src/login/login.h" + (*fromchar_parse_wrong_pincode) (int fd); + void (*fromchar_parse_accinfo) (int fd); + int (*parse_fromchar) (int fd); + void (*connection_problem) (int fd, uint8 status); + void (*kick) (struct login_session_data* sd); + void (*auth_ok) (struct login_session_data* sd); + void (*auth_failed) (struct login_session_data* sd, int result); + void (*login_error) (int fd, uint8 status); + void (*parse_ping) (int fd, struct login_session_data* sd); + void (*parse_client_md5) (int fd, struct login_session_data* sd); + +# 206 "../../../server-code/src/login/login.h" 3 4 +_Bool +# 206 "../../../server-code/src/login/login.h" + (*parse_client_login) (int fd, struct login_session_data* sd, const char *ip); + void (*send_coding_key) (int fd, struct login_session_data* sd); + void (*parse_request_coding_key) (int fd, struct login_session_data* sd); + void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); + void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); + int (*parse_login) (int fd); + void (*config_set_defaults) (void); + int (*config_read) (const char *cfgName); + char *LOGIN_CONF_NAME; + char *NET_CONF_NAME; +}; + + +extern struct mmo_char_server server[30]; + +void login_defaults(void); + + +extern struct login_interface *login; +# 24 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/login/HPMlogin.h" 1 +# 28 "../../../server-code/src/login/HPMlogin.h" +# 1 "../../../server-code/src/common/HPM.h" 1 +# 29 "../../../server-code/src/common/HPM.h" +# 1 "../../../server-code/src/common/HPMi.h" 1 +# 24 "../../../server-code/src/common/HPMi.h" +# 1 "../../../server-code/src/common/console.h" 1 +# 25 "../../../server-code/src/common/console.h" +# 1 "../../../server-code/src/common/mutex.h" 1 +# 26 "../../../server-code/src/common/mutex.h" +typedef struct ramutex ramutex; +typedef struct racond racond; + + + + + + + +ramutex *ramutex_create(void); + + + + + + +void ramutex_destroy(ramutex *m); + + + + + + +void ramutex_lock(ramutex *m); +# 58 "../../../server-code/src/common/mutex.h" + +# 58 "../../../server-code/src/common/mutex.h" 3 4 +_Bool +# 58 "../../../server-code/src/common/mutex.h" + ramutex_trylock(ramutex *m); + + + + + + +void ramutex_unlock(ramutex *m); + + + + + + + +racond *racond_create(void); + + + + + + +void racond_destroy(racond *c); +# 89 "../../../server-code/src/common/mutex.h" +void racond_wait(racond *c, ramutex *m, sysint timeout_ticks); +# 99 "../../../server-code/src/common/mutex.h" +void racond_signal(racond *c); +# 108 "../../../server-code/src/common/mutex.h" +void racond_broadcast(racond *c); +# 26 "../../../server-code/src/common/console.h" 2 +# 1 "../../../server-code/src/common/spinlock.h" 1 +# 31 "../../../server-code/src/common/spinlock.h" +# 1 "../../../server-code/src/common/atomic.h" 1 +# 110 "../../../server-code/src/common/atomic.h" +static __attribute__((always_inline)) inline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){ + return __sync_fetch_and_add(addend, increment); +} + +static __attribute__((always_inline)) inline int64 InterlockedIncrement64(volatile int64 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedIncrement(volatile int32 *addend){ + return __sync_add_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedDecrement64(volatile int64 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int32 InterlockedDecrement(volatile int32 *addend){ + return __sync_sub_and_fetch(addend, 1); +} + +static __attribute__((always_inline)) inline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){ + return __sync_val_compare_and_swap(dest, cmp, exch); +} + +static __attribute__((always_inline)) inline int64 InterlockedExchange64(volatile int64 *target, int64 val){ + return __sync_lock_test_and_set(target, val); +} + +static __attribute__((always_inline)) inline int32 InterlockedExchange(volatile int32 *target, int32 val){ + return __sync_lock_test_and_set(target, val); +} +# 32 "../../../server-code/src/common/spinlock.h" 2 + +# 1 "../../../server-code/src/common/thread.h" 1 +# 26 "../../../server-code/src/common/thread.h" +typedef struct rAthread rAthread; +typedef void* (*rAthreadProc)(void*); + +typedef enum RATHREAD_PRIO { + RAT_PRIO_LOW = 0, + RAT_PRIO_NORMAL, + RAT_PRIO_HIGH +} RATHREAD_PRIO; +# 45 "../../../server-code/src/common/thread.h" +rAthread *rathread_create(rAthreadProc entryPoint, void *param); +# 58 "../../../server-code/src/common/thread.h" +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); +# 68 "../../../server-code/src/common/thread.h" +void rathread_destroy(rAthread *handle); +# 79 "../../../server-code/src/common/thread.h" +rAthread *rathread_self(void); +# 90 "../../../server-code/src/common/thread.h" +int rathread_get_tid(void); +# 101 "../../../server-code/src/common/thread.h" + +# 101 "../../../server-code/src/common/thread.h" 3 4 +_Bool +# 101 "../../../server-code/src/common/thread.h" + rathread_wait(rAthread *handle, void **out_exitCode); +# 110 "../../../server-code/src/common/thread.h" +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio); + + + + + + + +RATHREAD_PRIO rathread_prio_get(rAthread *handle); +# 128 "../../../server-code/src/common/thread.h" +void rathread_yield(void); + +void rathread_init(void); +void rathread_final(void); +# 34 "../../../server-code/src/common/spinlock.h" 2 +# 47 "../../../server-code/src/common/spinlock.h" +typedef struct SPIN_LOCK{ + volatile int32 lock; + volatile int32 nest; + + volatile int32 sync_lock; +} __attribute__((aligned(64))) SPIN_LOCK; + + + + +static __attribute__((always_inline)) inline void InitializeSpinLock(SPIN_LOCK *lck){ + lck->lock = 0; + lck->nest = 0; + lck->sync_lock = 0; +} + +static __attribute__((always_inline)) inline void FinalizeSpinLock(SPIN_LOCK *lck){ + return; +} + + + + + +static __attribute__((always_inline)) inline void EnterSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + InterlockedIncrement(&lck->nest); + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + return; + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); + + + while(1){ + if(InterlockedCompareExchange(&lck->lock, tid, 0) == 0){ + InterlockedIncrement(&lck->nest); + return; + } + rathread_yield(); + } + +} + + +static __attribute__((always_inline)) inline void LeaveSpinLock(SPIN_LOCK *lck){ + int tid = rathread_get_tid(); + + do { if(InterlockedCompareExchange((&lck->sync_lock), 1, 0) == 0) break; rathread_yield(); } while( 1); + + if(InterlockedCompareExchange(&lck->lock, tid, tid) == tid){ + if(InterlockedDecrement(&lck->nest) == 0) + InterlockedExchange(&lck->lock, 0); + } + + do { InterlockedExchange((&lck->sync_lock), 0); } while(0); +} +# 27 "../../../server-code/src/common/console.h" 2 + + + +struct Sql; +# 41 "../../../server-code/src/common/console.h" +typedef void (*CParseFunc)(char *line); +# 56 "../../../server-code/src/common/console.h" +enum CONSOLE_PARSE_ENTRY_TYPE { + CPET_UNKNOWN, + CPET_FUNCTION, + CPET_CATEGORY, +}; + +struct CParseEntry { + char cmd[20]; + int type; + union { + CParseFunc func; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } children; + } u; +}; + +struct console_input_interface { + + + SPIN_LOCK ptlock; + rAthread *pthread; + volatile int32 ptstate; + ramutex *ptmutex; + racond *ptcond; + + struct { int _max_; int _len_; struct CParseEntry * *_data_; } command_list; + struct { int _max_; int _len_; struct CParseEntry * *_data_; } commands; + + struct Sql *SQL; + + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + void (*parse_sub) (char* line); + int (*key_pressed) (void); + void (*load_defaults) (void); + void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); + void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (struct Sql *SQL_handle); + + + +}; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + void (*display_gplnotice) (void); + + struct console_input_interface *input; +}; + + +void console_defaults(void); + + +extern struct console_interface *console; +# 25 "../../../server-code/src/common/HPMi.h" 2 + +# 1 "../../../server-code/src/common/showmsg.h" 1 +# 29 "../../../server-code/src/common/showmsg.h" +struct config_setting_t; +# 89 "../../../server-code/src/common/showmsg.h" +enum msg_type { + MSG_NONE, + MSG_STATUS, + MSG_SQL, + MSG_INFORMATION, + MSG_NOTICE, + MSG_WARNING, + MSG_DEBUG, + MSG_ERROR, + MSG_FATALERROR +}; + +struct showmsg_interface { + +# 102 "../../../server-code/src/common/showmsg.h" 3 4 +_Bool +# 102 "../../../server-code/src/common/showmsg.h" + stdout_with_ansisequence; + int silent; + int console_log; + char timestamp_format[20]; + + void (*init) (void); + void (*final) (void); + + void (*clearScreen) (void); + int (*showMessageV) (const char *string, va_list ap); + + void (*showMessage) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showStatus) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showSQL) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showInfo) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showNotice) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showWarning) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showDebug) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); + void (*showConfigWarning) (struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +}; +# 140 "../../../server-code/src/common/showmsg.h" +void showmsg_defaults(void); + + +extern struct showmsg_interface *showmsg; +# 27 "../../../server-code/src/common/HPMi.h" 2 + +struct Sql; +struct script_state; +struct AtCommandInfo; +struct socket_data; +struct map_session_data; +struct hplugin_data_store; + + + + +struct hplugin_info { + char* name; + enum server_types type; + char* version; + char* req_version; +}; + +struct s_HPMDataCheck { + char *name; + unsigned int size; + int type; +}; + + + +enum hp_event_types { + HPET_INIT, + HPET_FINAL, + HPET_READY, + HPET_POST_FINAL, + HPET_PRE_INIT, + HPET_MAX, +}; + +enum HPluginPacketHookingPoints { + hpClif_Parse, + hpChrif_Parse, + hpParse_FromMap, + hpParse_FromLogin, + hpParse_Char, + hpParse_FromChar, + hpParse_Login, + + hpPHP_MAX, +}; + +enum HPluginHookType { + HOOK_TYPE_PRE, + HOOK_TYPE_POST, +}; + + + + +enum HPluginDataTypes { + HPDT_UNKNOWN, + HPDT_SESSION, + HPDT_MSD, + HPDT_NPCD, + HPDT_MAP, + HPDT_INSTANCE, + HPDT_GUILD, + HPDT_PARTY, + HPDT_MOBDB, + HPDT_MOBDATA, + HPDT_ITEMDATA, + HPDT_BGDATA, + HPDT_AUTOTRADE_VEND, +}; + + +enum HPluginConfType { + HPCT_BATTLE, + HPCT_LOGIN, + HPCT_CHAR, + HPCT_CHAR_INTER, + HPCT_MAP_INTER, + HPCT_LOG, + HPCT_SCRIPT, + HPCT_MAX, +}; +# 220 "../../../server-code/src/common/HPMi.h" +struct HPMi_interface { + + unsigned int pid; + + void (*event[HPET_MAX]) (void); + +# 225 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*addCommand) (char *name, +# 225 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 225 "../../../server-code/src/common/HPMi.h" + (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); + +# 226 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*addScript) (char *name, char *args, +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + (*func)(struct script_state *st), +# 226 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 226 "../../../server-code/src/common/HPMi.h" + isDeprecated); + void (*addCPCommand) (char *name, CParseFunc func); + + void (*addToHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, +# 229 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 229 "../../../server-code/src/common/HPMi.h" + autofree); + void *(*getFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); + + +# 233 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 233 "../../../server-code/src/common/HPMi.h" + (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); + + +# 235 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 235 "../../../server-code/src/common/HPMi.h" + (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + void (*HookStop) (const char *func, unsigned int pID); + +# 237 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 237 "../../../server-code/src/common/HPMi.h" + (*HookStopped) (void); + + +# 239 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 239 "../../../server-code/src/common/HPMi.h" + (*addArg) (unsigned int pluginID, char *name, +# 239 "../../../server-code/src/common/HPMi.h" 3 4 + _Bool +# 239 "../../../server-code/src/common/HPMi.h" + has_param, CmdlineExecFunc func, const char *help); + + +# 241 "../../../server-code/src/common/HPMi.h" 3 4 +_Bool +# 241 "../../../server-code/src/common/HPMi.h" + (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key)); + + void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + struct Sql *sql_handle; +}; +# 30 "../../../server-code/src/common/HPM.h" 2 +# 44 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/dlfcn.h" 1 3 4 +# 24 "/usr/include/dlfcn.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/dlfcn.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/dlfcn.h" 1 3 4 +# 28 "/usr/include/dlfcn.h" 2 3 4 +# 52 "/usr/include/dlfcn.h" 3 4 + + + + + +# 56 "/usr/include/dlfcn.h" 3 4 +extern void *dlopen (const char *__file, int __mode) __attribute__ ((__nothrow__)); + + + +extern int dlclose (void *__handle) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + + + +extern void *dlsym (void *__restrict __handle, + const char *__restrict __name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); +# 82 "/usr/include/dlfcn.h" 3 4 +extern char *dlerror (void) __attribute__ ((__nothrow__ , __leaf__)); +# 188 "/usr/include/dlfcn.h" 3 4 + +# 45 "../../../server-code/src/common/HPM.h" 2 +# 64 "../../../server-code/src/common/HPM.h" +# 1 "/usr/include/string.h" 1 3 4 +# 27 "/usr/include/string.h" 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/string.h" 2 3 4 + + + + + + + + + +extern void *memcpy (void *__restrict __dest, const void *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void *memmove (void *__dest, const void *__src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern void *memccpy (void *__restrict __dest, const void *__restrict __src, + int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int memcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 92 "/usr/include/string.h" 3 4 +extern void *memchr (const void *__s, int __c, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 123 "/usr/include/string.h" 3 4 + + +extern char *strcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern char *strcat (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern char *strncat (char *__restrict __dest, const char *__restrict __src, + size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int strncmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strcoll (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + +extern size_t strxfrm (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +# 162 "/usr/include/string.h" 3 4 +extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); + +extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, + __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + + + + +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern char *strndup (const char *__string, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); +# 206 "/usr/include/string.h" 3 4 + +# 231 "/usr/include/string.h" 3 4 +extern char *strchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 258 "/usr/include/string.h" 3 4 +extern char *strrchr (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + +# 277 "/usr/include/string.h" 3 4 + + + +extern size_t strcspn (const char *__s, const char *__reject) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern size_t strspn (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 310 "/usr/include/string.h" 3 4 +extern char *strpbrk (const char *__s, const char *__accept) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 337 "/usr/include/string.h" 3 4 +extern char *strstr (const char *__haystack, const char *__needle) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strtok (char *__restrict __s, const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern char *__strtok_r (char *__restrict __s, + const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); + +extern char *strtok_r (char *__restrict __s, const char *__restrict __delim, + char **__restrict __save_ptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))); +# 392 "/usr/include/string.h" 3 4 + + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern size_t strnlen (const char *__string, size_t __maxlen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__)); + +# 422 "/usr/include/string.h" 3 4 +extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) + + __attribute__ ((__nonnull__ (2))); +# 440 "/usr/include/string.h" 3 4 +extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern void bcopy (const void *__src, void *__dest, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern int bcmp (const void *__s1, const void *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 484 "/usr/include/string.h" 3 4 +extern char *index (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); +# 512 "/usr/include/string.h" 3 4 +extern char *rindex (const char *__s, int __c) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); + + + + +extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 529 "/usr/include/string.h" 3 4 +extern int strcasecmp (const char *__s1, const char *__s2) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); +# 552 "/usr/include/string.h" 3 4 +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__)); + + +extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpcpy (char *__restrict __dest, const char *__restrict __src) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern char *__stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern char *stpncpy (char *__restrict __dest, + const char *__restrict __src, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 639 "/usr/include/string.h" 3 4 + +# 65 "../../../server-code/src/common/HPM.h" 2 + + + + +# 68 "../../../server-code/src/common/HPM.h" +struct hplugin { + void * dll; + unsigned int idx; + char *filename; + struct hplugin_info *info; + struct HPMi_interface *hpi; +}; + + + + +struct hpm_symbol { + const char *name; + void *ptr; +}; + + + + +struct hplugin_data_entry { + uint32 pluginID; + uint32 classid; + struct { + unsigned int free : 1; + } flag; + void *data; +}; + + + + +struct hplugin_data_store { + enum HPluginDataTypes type; + struct { int _max_; int _len_; struct hplugin_data_entry * *_data_; } entries; +}; + +struct HPluginPacket { + unsigned int pluginID; + unsigned short cmd; + short len; + void (*receive) (int fd); +}; + +struct HPMFileNameCache { + const char *addr; + char *name; +}; + + +struct HPConfListenStorage { + unsigned int pluginID; + char key[40]; + void (*parse_func) (const char *key, const char *val); + int (*return_func) (const char *key); +}; + + +struct HPM_interface { + + unsigned int version[2]; + +# 128 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/HPM.h" + off; + +# 129 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 129 "../../../server-code/src/common/HPM.h" + hooking; + + +# 131 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 131 "../../../server-code/src/common/HPM.h" + force_return; + + struct { int _max_; int _len_; struct hplugin * *_data_; } plugins; + struct { int _max_; int _len_; struct hpm_symbol * *_data_; } symbols; + + struct { int _max_; int _len_; struct HPluginPacket *_data_; } packets[hpPHP_MAX]; + + struct { + + int count; + struct HPMFileNameCache *data; + } filenames; + + struct { int _max_; int _len_; struct HPConfListenStorage *_data_; } config_listeners[HPCT_MAX]; + + struct { int _max_; int _len_; char * *_data_; } cmdline_load_plugins; + + void (*init) (void); + void (*final) (void); + struct hplugin * (*create) (void); + struct hplugin * (*load) (const char* filename); + void (*unload) (struct hplugin* plugin); + +# 153 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 153 "../../../server-code/src/common/HPM.h" + (*exists) (const char *filename); + +# 154 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 154 "../../../server-code/src/common/HPM.h" + (*iscompatible) (char* version); + void (*event) (enum hp_event_types type); + void *(*import_symbol) (char *name, unsigned int pID); + void (*share) (void *value, const char *name); + void (*config_read) (void); + char *(*pid2name) (unsigned int pid); + unsigned char (*parse_packets) (int fd, int packet_id, enum HPluginPacketHookingPoints point); + void (*load_sub) (struct hplugin *plugin); + +# 162 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 162 "../../../server-code/src/common/HPM.h" + (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); + + +# 164 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 164 "../../../server-code/src/common/HPM.h" + (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + +# 165 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 165 "../../../server-code/src/common/HPM.h" + (*getBattleConf) (const char* w1, int *value); + + +# 167 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 167 "../../../server-code/src/common/HPM.h" + (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, int version, char *name); + void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version); + void (*datacheck_final) (void); + + void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type); + void (*data_store_destroy) (struct hplugin_data_store **storeptr); + +# 173 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 173 "../../../server-code/src/common/HPM.h" + (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 173 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 173 "../../../server-code/src/common/HPM.h" + initialize); + + +# 175 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 175 "../../../server-code/src/common/HPM.h" + (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 175 "../../../server-code/src/common/HPM.h" 3 4 + _Bool +# 175 "../../../server-code/src/common/HPM.h" + initialize); +}; + + +# 178 "../../../server-code/src/common/HPM.h" 3 4 +_Bool +# 178 "../../../server-code/src/common/HPM.h" +cmdline_arg_loadplugin (const char *name, const char *params); + +extern struct HPM_interface *HPM; + +void hpm_defaults(void); +# 29 "../../../server-code/src/login/HPMlogin.h" 2 + +struct hplugin; + + +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + HPM_login_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, +# 32 "../../../server-code/src/login/HPMlogin.h" 3 4 + _Bool +# 32 "../../../server-code/src/login/HPMlogin.h" + initialize); + +void HPM_login_plugin_load_sub(struct hplugin *plugin); + +void HPM_login_do_final(void); + +void HPM_login_do_init(void); +# 26 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/account.h" 1 +# 28 "../../../server-code/src/login/account.h" +struct Sql; + +typedef struct AccountDB AccountDB; +typedef struct AccountDBIterator AccountDBIterator; + + + + +AccountDB* account_db_sql(void); + + +struct mmo_account +{ + int account_id; + char userid[(23 + 1)]; + char pass[32+1]; + char sex; + char email[40]; + int group_id; + uint8 char_slots; + unsigned int state; + time_t unban_time; + time_t expiration_time; + unsigned int logincount; + unsigned int pincode_change; + char pincode[4+1]; + char lastlogin[24]; + char last_ip[16]; + char birthdate[10+1]; +}; + + +struct AccountDBIterator +{ + + + + void (*destroy)(AccountDBIterator* self); + + + + + + + +# 72 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 72 "../../../server-code/src/login/account.h" + (*next)(AccountDBIterator* self, struct mmo_account* acc); +}; + +struct Account_engine { + AccountDB* (*constructor)(void); + AccountDB* db; +}; + +struct AccountDB +{ + + + + + + +# 87 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 87 "../../../server-code/src/login/account.h" + (*init)(AccountDB* self); + + + + + void (*destroy)(AccountDB* self); +# 105 "../../../server-code/src/login/account.h" + +# 105 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 105 "../../../server-code/src/login/account.h" + (*get_property)(AccountDB* self, const char* key, char* buf, size_t buflen); + + + + + + + + +# 113 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 113 "../../../server-code/src/login/account.h" + (*set_property)(AccountDB* self, const char* key, const char* value); +# 122 "../../../server-code/src/login/account.h" + +# 122 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 122 "../../../server-code/src/login/account.h" + (*create)(AccountDB* self, struct mmo_account* acc); + + + + + + + +# 129 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 129 "../../../server-code/src/login/account.h" + (*remove)(AccountDB* self, const int account_id); + + + + + + + + +# 137 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 137 "../../../server-code/src/login/account.h" + (*save)(AccountDB* self, const struct mmo_account* acc); + + + + + + + + +# 145 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 145 "../../../server-code/src/login/account.h" + (*load_num)(AccountDB* self, struct mmo_account* acc, const int account_id); + + + + + + + + +# 153 "../../../server-code/src/login/account.h" 3 4 +_Bool +# 153 "../../../server-code/src/login/account.h" + (*load_str)(AccountDB* self, struct mmo_account* acc, const char* userid); + + + + + + AccountDBIterator* (*iterator)(AccountDB* self); +}; + + +struct Sql *account_db_sql_up(AccountDB* self); + +void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); +void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); +# 27 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/ipban.h" 1 +# 29 "../../../server-code/src/login/ipban.h" +void ipban_init(void); + + +void ipban_final(void); + + + +# 35 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 35 "../../../server-code/src/login/ipban.h" + ipban_check(uint32 ip); + + +void ipban_log(uint32 ip); + + + +# 41 "../../../server-code/src/login/ipban.h" 3 4 +_Bool +# 41 "../../../server-code/src/login/ipban.h" + ipban_config_read(const char *key, const char* value); +# 28 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/login/loginlog.h" 1 +# 28 "../../../server-code/src/login/loginlog.h" +unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); +void login_log(uint32 ip, const char* username, int rcode, const char* message); + +# 30 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 30 "../../../server-code/src/login/loginlog.h" + loginlog_init(void); + +# 31 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 31 "../../../server-code/src/login/loginlog.h" + loginlog_final(void); + +# 32 "../../../server-code/src/login/loginlog.h" 3 4 +_Bool +# 32 "../../../server-code/src/login/loginlog.h" + loginlog_config_read(const char* w1, const char* w2); +# 29 "../../../server-code/src/login/login.c" 2 + + + + +# 1 "../../../server-code/src/common/memmgr.h" 1 +# 80 "../../../server-code/src/common/memmgr.h" +struct malloc_interface { + void (*init) (void); + void (*final) (void); + + void* (*malloc)(size_t size, const char *file, int line, const char *func); + void* (*calloc)(size_t num, size_t size, const char *file, int line, const char *func); + void* (*realloc)(void *p, size_t size, const char *file, int line, const char *func); + void* (*reallocz)(void *p, size_t size, const char *file, int line, const char *func); + char* (*astrdup)(const char *p, const char *file, int line, const char *func); + char *(*astrndup)(const char *p, size_t size, const char *file, int line, const char *func); + void (*free)(void *p, const char *file, int line, const char *func); + + void (*memory_check)(void); + +# 93 "../../../server-code/src/common/memmgr.h" 3 4 +_Bool +# 93 "../../../server-code/src/common/memmgr.h" + (*verify_ptr)(void* ptr); + size_t (*usage) (void); + + void (*post_shutdown) (void); + void (*init_messages) (void); +}; + + +void malloc_defaults(void); + +void memmgr_report(int extra); + + +extern struct malloc_interface *iMalloc; +# 34 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/md5calc.h" 1 +# 25 "../../../server-code/src/common/md5calc.h" +void MD5_String(const char * string, char * output); +void MD5_Binary(const char * string, unsigned char * output); +void MD5_Salt(unsigned int len, char * output); +# 35 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/nullpo.h" 1 +# 40 "../../../server-code/src/common/nullpo.h" +# 1 "/usr/include/assert.h" 1 3 4 +# 66 "/usr/include/assert.h" 3 4 + + + + +# 69 "/usr/include/assert.h" 3 4 +extern void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + +extern void __assert_perror_fail (int __errnum, const char *__file, + unsigned int __line, const char *__function) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + +extern void __assert (const char *__assertion, const char *__file, int __line) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +# 41 "../../../server-code/src/common/nullpo.h" 2 +# 155 "../../../server-code/src/common/nullpo.h" + +# 155 "../../../server-code/src/common/nullpo.h" +struct nullpo_interface { + void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); +}; + + +void nullpo_defaults(void); + + +extern struct nullpo_interface *nullpo; +# 36 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/random.h" 1 +# 27 "../../../server-code/src/common/random.h" +void rnd_init(void); +void rnd_seed(uint32); + +int32 rnd(void); +uint32 rnd_roll(uint32 dice_faces); +int32 rnd_value(int32 min, int32 max); +double rnd_uniform(void); +double rnd_uniform53(void); +# 37 "../../../server-code/src/login/login.c" 2 + +# 1 "../../../server-code/src/common/socket.h" 1 +# 39 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/strlib.h" 1 +# 54 "../../../server-code/src/common/strlib.h" +typedef enum e_svopt { + + SV_NOESCAPE_NOTERMINATE = 0, + + SV_ESCAPE_C = 1, + + SV_TERMINATE_LF = 2, + SV_TERMINATE_CRLF = 4, + SV_TERMINATE_CR = 8, + + SV_KEEP_TERMINATOR = 16 +} e_svopt; + + + + + + +struct s_svstate { + const char* str; + int len; + int off; + int start; + int end; + enum e_svopt opt; + char delim; + +# 80 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 80 "../../../server-code/src/common/strlib.h" + done; +}; + + + +struct StringBuf { + char *buf_; + char *ptr_; + unsigned int max_; +}; +typedef struct StringBuf StringBuf; + +struct strlib_interface { + char *(*jstrescape) (char* pt); + char *(*jstrescapecpy) (char* pt, const char* spt); + int (*jmemescapecpy) (char* pt, const char* spt, int size); + int (*remove_control_chars_) (char* str); + char *(*trim_) (char* str); + char *(*normalize_name_) (char* str,const char* delims); + const char *(*stristr_) (const char *haystack, const char *needle); + + + size_t (*strnlen_) (const char* string, size_t maxlen); + + + char * (*strtok_r_) (char *s1, const char *s2, char **lasts); + + int (*e_mail_check_) (char* email); + int (*config_switch_) (const char* str); + + + char *(*safestrncpy_) (char* dst, const char* src, size_t n); + + + size_t (*safestrnlen_) (const char* string, size_t maxlen); + + + + + int (*safesnprintf_) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); + + + + int (*strline_) (const char* str, size_t pos); + + + + + +# 128 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 128 "../../../server-code/src/common/strlib.h" + (*bin2hex_) (char* output, unsigned char* input, size_t count); +}; + +struct stringbuf_interface { + StringBuf* (*Malloc) (void); + void (*Init) (StringBuf* self); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); + int (*Vprintf) (StringBuf* self, const char* fmt, va_list args); + int (*Append) (StringBuf* self, const StringBuf *sbuf); + int (*AppendStr) (StringBuf* self, const char* str); + int (*Length) (StringBuf* self); + char* (*Value) (StringBuf* self); + void (*Clear) (StringBuf* self); + void (*Destroy) (StringBuf* self); + void (*Free) (StringBuf* self); +}; + +struct sv_interface { + + + + + + int (*parse_next) (struct s_svstate* svstate); + + + + + + + int (*parse) (const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt); + + + + + + + + int (*split) (char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt); + + + + + size_t (*escape_c) (char* out_dest, const char* src, size_t len, const char* escapes); + + + + + size_t (*unescape_c) (char* out_dest, const char* src, size_t len); + + + const char* (*skip_escaped_c) (const char* p); + + + + + +# 184 "../../../server-code/src/common/strlib.h" 3 4 +_Bool +# 184 "../../../server-code/src/common/strlib.h" + (*readdb) (const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, +# 184 "../../../server-code/src/common/strlib.h" 3 4 + _Bool +# 184 "../../../server-code/src/common/strlib.h" + (*parseproc)(char* fields[], int columns, int current)); +}; + + +void strlib_defaults(void); + + +extern struct strlib_interface *strlib; +extern struct stringbuf_interface *StrBuf; +extern struct sv_interface *sv; +# 40 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/timer.h" 1 +# 32 "../../../server-code/src/common/timer.h" +enum { + TIMER_ONCE_AUTODEL = 0x01, + TIMER_INTERVAL = 0x02, + TIMER_REMOVE_HEAP = 0x10, +}; + + + +typedef int (*TimerFunc)(int tid, int64 tick, int id, intptr_t data); + +struct TimerData { + int64 tick; + TimerFunc func; + unsigned char type; + int interval; + + + int id; + intptr_t data; +}; + + + + + + + +struct timer_interface { + + + int64 (*gettick) (void); + int64 (*gettick_nocache) (void); + + int (*add) (int64 tick, TimerFunc func, int id, intptr_t data); + int (*add_interval) (int64 tick, TimerFunc func, int id, intptr_t data, int interval); + const struct TimerData *(*get) (int tid); + int (*delete) (int tid, TimerFunc func); + + int64 (*addtick) (int tid, int64 tick); + int64 (*settick) (int tid, int64 tick); + + int (*add_func_list) (TimerFunc func, char* name); + + unsigned long (*get_uptime) (void); + + int (*perform) (int64 tick); + void (*init) (void); + void (*final) (void); +}; + + +void timer_defaults(void); + + +extern struct timer_interface *timer; +# 41 "../../../server-code/src/login/login.c" 2 +# 1 "../../../server-code/src/common/utils.h" 1 +# 26 "../../../server-code/src/common/utils.h" +# 1 "/usr/include/stdio.h" 1 3 4 +# 29 "/usr/include/stdio.h" 3 4 + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 34 "/usr/include/stdio.h" 2 3 4 +# 44 "/usr/include/stdio.h" 3 4 + +# 44 "/usr/include/stdio.h" 3 4 +struct _IO_FILE; + + + +typedef struct _IO_FILE FILE; + + + + + +# 64 "/usr/include/stdio.h" 3 4 +typedef struct _IO_FILE __FILE; +# 74 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/libio.h" 1 3 4 +# 31 "/usr/include/libio.h" 3 4 +# 1 "/usr/include/_G_config.h" 1 3 4 +# 15 "/usr/include/_G_config.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 16 "/usr/include/_G_config.h" 2 3 4 + + + + +# 1 "/usr/include/wchar.h" 1 3 4 +# 82 "/usr/include/wchar.h" 3 4 +typedef struct +{ + int __count; + union + { + + unsigned int __wch; + + + + char __wchb[4]; + } __value; +} __mbstate_t; +# 21 "/usr/include/_G_config.h" 2 3 4 +typedef struct +{ + __off_t __pos; + __mbstate_t __state; +} _G_fpos_t; +typedef struct +{ + __off64_t __pos; + __mbstate_t __state; +} _G_fpos64_t; +# 32 "/usr/include/libio.h" 2 3 4 +# 144 "/usr/include/libio.h" 3 4 +struct _IO_jump_t; struct _IO_FILE; + + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + + + + int _pos; +# 173 "/usr/include/libio.h" 3 4 +}; + + +enum __codecvt_result +{ + __codecvt_ok, + __codecvt_partial, + __codecvt_error, + __codecvt_noconv +}; +# 241 "/usr/include/libio.h" 3 4 +struct _IO_FILE { + int _flags; + + + + + char* _IO_read_ptr; + char* _IO_read_end; + char* _IO_read_base; + char* _IO_write_base; + char* _IO_write_ptr; + char* _IO_write_end; + char* _IO_buf_base; + char* _IO_buf_end; + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + + + + int _flags2; + + __off_t _old_offset; + + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + + + _IO_lock_t *_lock; +# 289 "/usr/include/libio.h" 3 4 + __off64_t _offset; +# 298 "/usr/include/libio.h" 3 4 + void *__pad1; + void *__pad2; + void *__pad3; + void *__pad4; + size_t __pad5; + + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; + +}; + + +typedef struct _IO_FILE _IO_FILE; + + +struct _IO_FILE_plus; + +extern struct _IO_FILE_plus _IO_2_1_stdin_; +extern struct _IO_FILE_plus _IO_2_1_stdout_; +extern struct _IO_FILE_plus _IO_2_1_stderr_; +# 334 "/usr/include/libio.h" 3 4 +typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes); + + + + + + + +typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf, + size_t __n); + + + + + + + +typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w); + + +typedef int __io_close_fn (void *__cookie); +# 386 "/usr/include/libio.h" 3 4 +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +# 430 "/usr/include/libio.h" 3 4 +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); +extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__)); + +extern int _IO_peekc_locked (_IO_FILE *__fp); + + + + + +extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 460 "/usr/include/libio.h" 3 4 +extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, + __gnuc_va_list, int *__restrict); +extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, + __gnuc_va_list); +extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t); +extern size_t _IO_sgetn (_IO_FILE *, void *, size_t); + +extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int); +extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int); + +extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__)); +# 75 "/usr/include/stdio.h" 2 3 4 +# 90 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 102 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + + +typedef _G_fpos_t fpos_t; + + + + +# 164 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 165 "/usr/include/stdio.h" 2 3 4 + + + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern FILE *tmpfile (void) ; +# 209 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 227 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); + +# 252 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 266 "/usr/include/stdio.h" 3 4 + + + + + + +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 295 "/usr/include/stdio.h" 3 4 + +# 306 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 319 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); + +# 412 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 443 "/usr/include/stdio.h" 3 4 +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 463 "/usr/include/stdio.h" 3 4 + + + + + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); +# 494 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 522 "/usr/include/stdio.h" 3 4 + + + + + + + + + +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + +# 550 "/usr/include/stdio.h" 3 4 +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 561 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); + + + + + + + + + + + +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); + +# 594 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 640 "/usr/include/stdio.h" 3 4 + +# 665 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); + +# 737 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); + +# 773 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 792 "/usr/include/stdio.h" 3 4 + + + + + + +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 815 "/usr/include/stdio.h" 3 4 + +# 824 "/usr/include/stdio.h" 3 4 + + +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + + +extern void perror (const char *__s); + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 854 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 872 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 912 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 942 "/usr/include/stdio.h" 3 4 + +# 27 "../../../server-code/src/common/utils.h" 2 + +# 1 "/usr/include/unistd.h" 1 3 4 +# 27 "/usr/include/unistd.h" 3 4 + +# 205 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/posix_opt.h" 1 3 4 +# 206 "/usr/include/unistd.h" 2 3 4 + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/environments.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/environments.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/environments.h" 2 3 4 +# 210 "/usr/include/unistd.h" 2 3 4 +# 229 "/usr/include/unistd.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 230 "/usr/include/unistd.h" 2 3 4 + + + + + +typedef __gid_t gid_t; + + + + +typedef __uid_t uid_t; +# 258 "/usr/include/unistd.h" 3 4 +typedef __useconds_t useconds_t; +# 277 "/usr/include/unistd.h" 3 4 +typedef __socklen_t socklen_t; +# 290 "/usr/include/unistd.h" 3 4 +extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 307 "/usr/include/unistd.h" 3 4 +extern int faccessat (int __fd, const char *__file, int __type, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; +# 337 "/usr/include/unistd.h" 3 4 +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__)); +# 356 "/usr/include/unistd.h" 3 4 +extern int close (int __fd); + + + + + + +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ; + + + + + +extern ssize_t write (int __fd, const void *__buf, size_t __n) ; +# 379 "/usr/include/unistd.h" 3 4 +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, + __off_t __offset) ; + + + + + + +extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, + __off_t __offset) ; +# 420 "/usr/include/unistd.h" 3 4 +extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 435 "/usr/include/unistd.h" 3 4 +extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__)); +# 447 "/usr/include/unistd.h" 3 4 +extern unsigned int sleep (unsigned int __seconds); + + + + + + + +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int usleep (__useconds_t __useconds); +# 472 "/usr/include/unistd.h" 3 4 +extern int pause (void); + + + +extern int chown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + +extern int fchownat (int __fd, const char *__file, __uid_t __owner, + __gid_t __group, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; +# 514 "/usr/include/unistd.h" 3 4 +extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ; +# 528 "/usr/include/unistd.h" 3 4 +extern char *getwd (char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ; + + + + +extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__)); +# 546 "/usr/include/unistd.h" 3 4 +extern char **__environ; + + + + + + + +extern int execve (const char *__path, char *const __argv[], + char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int fexecve (int __fd, char *const __argv[], char *const __envp[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + + +extern int execv (const char *__path, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execle (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execl (const char *__path, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + +extern int execvp (const char *__file, char *const __argv[]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + +extern int execlp (const char *__file, const char *__arg, ...) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +# 601 "/usr/include/unistd.h" 3 4 +extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern void _exit (int __status) __attribute__ ((__noreturn__)); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/confname.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/bits/confname.h" 3 4 +enum + { + _PC_LINK_MAX, + + _PC_MAX_CANON, + + _PC_MAX_INPUT, + + _PC_NAME_MAX, + + _PC_PATH_MAX, + + _PC_PIPE_BUF, + + _PC_CHOWN_RESTRICTED, + + _PC_NO_TRUNC, + + _PC_VDISABLE, + + _PC_SYNC_IO, + + _PC_ASYNC_IO, + + _PC_PRIO_IO, + + _PC_SOCK_MAXBUF, + + _PC_FILESIZEBITS, + + _PC_REC_INCR_XFER_SIZE, + + _PC_REC_MAX_XFER_SIZE, + + _PC_REC_MIN_XFER_SIZE, + + _PC_REC_XFER_ALIGN, + + _PC_ALLOC_SIZE_MIN, + + _PC_SYMLINK_MAX, + + _PC_2_SYMLINKS + + }; + + +enum + { + _SC_ARG_MAX, + + _SC_CHILD_MAX, + + _SC_CLK_TCK, + + _SC_NGROUPS_MAX, + + _SC_OPEN_MAX, + + _SC_STREAM_MAX, + + _SC_TZNAME_MAX, + + _SC_JOB_CONTROL, + + _SC_SAVED_IDS, + + _SC_REALTIME_SIGNALS, + + _SC_PRIORITY_SCHEDULING, + + _SC_TIMERS, + + _SC_ASYNCHRONOUS_IO, + + _SC_PRIORITIZED_IO, + + _SC_SYNCHRONIZED_IO, + + _SC_FSYNC, + + _SC_MAPPED_FILES, + + _SC_MEMLOCK, + + _SC_MEMLOCK_RANGE, + + _SC_MEMORY_PROTECTION, + + _SC_MESSAGE_PASSING, + + _SC_SEMAPHORES, + + _SC_SHARED_MEMORY_OBJECTS, + + _SC_AIO_LISTIO_MAX, + + _SC_AIO_MAX, + + _SC_AIO_PRIO_DELTA_MAX, + + _SC_DELAYTIMER_MAX, + + _SC_MQ_OPEN_MAX, + + _SC_MQ_PRIO_MAX, + + _SC_VERSION, + + _SC_PAGESIZE, + + + _SC_RTSIG_MAX, + + _SC_SEM_NSEMS_MAX, + + _SC_SEM_VALUE_MAX, + + _SC_SIGQUEUE_MAX, + + _SC_TIMER_MAX, + + + + + _SC_BC_BASE_MAX, + + _SC_BC_DIM_MAX, + + _SC_BC_SCALE_MAX, + + _SC_BC_STRING_MAX, + + _SC_COLL_WEIGHTS_MAX, + + _SC_EQUIV_CLASS_MAX, + + _SC_EXPR_NEST_MAX, + + _SC_LINE_MAX, + + _SC_RE_DUP_MAX, + + _SC_CHARCLASS_NAME_MAX, + + + _SC_2_VERSION, + + _SC_2_C_BIND, + + _SC_2_C_DEV, + + _SC_2_FORT_DEV, + + _SC_2_FORT_RUN, + + _SC_2_SW_DEV, + + _SC_2_LOCALEDEF, + + + _SC_PII, + + _SC_PII_XTI, + + _SC_PII_SOCKET, + + _SC_PII_INTERNET, + + _SC_PII_OSI, + + _SC_POLL, + + _SC_SELECT, + + _SC_UIO_MAXIOV, + + _SC_IOV_MAX = _SC_UIO_MAXIOV, + + _SC_PII_INTERNET_STREAM, + + _SC_PII_INTERNET_DGRAM, + + _SC_PII_OSI_COTS, + + _SC_PII_OSI_CLTS, + + _SC_PII_OSI_M, + + _SC_T_IOV_MAX, + + + + _SC_THREADS, + + _SC_THREAD_SAFE_FUNCTIONS, + + _SC_GETGR_R_SIZE_MAX, + + _SC_GETPW_R_SIZE_MAX, + + _SC_LOGIN_NAME_MAX, + + _SC_TTY_NAME_MAX, + + _SC_THREAD_DESTRUCTOR_ITERATIONS, + + _SC_THREAD_KEYS_MAX, + + _SC_THREAD_STACK_MIN, + + _SC_THREAD_THREADS_MAX, + + _SC_THREAD_ATTR_STACKADDR, + + _SC_THREAD_ATTR_STACKSIZE, + + _SC_THREAD_PRIORITY_SCHEDULING, + + _SC_THREAD_PRIO_INHERIT, + + _SC_THREAD_PRIO_PROTECT, + + _SC_THREAD_PROCESS_SHARED, + + + _SC_NPROCESSORS_CONF, + + _SC_NPROCESSORS_ONLN, + + _SC_PHYS_PAGES, + + _SC_AVPHYS_PAGES, + + _SC_ATEXIT_MAX, + + _SC_PASS_MAX, + + + _SC_XOPEN_VERSION, + + _SC_XOPEN_XCU_VERSION, + + _SC_XOPEN_UNIX, + + _SC_XOPEN_CRYPT, + + _SC_XOPEN_ENH_I18N, + + _SC_XOPEN_SHM, + + + _SC_2_CHAR_TERM, + + _SC_2_C_VERSION, + + _SC_2_UPE, + + + _SC_XOPEN_XPG2, + + _SC_XOPEN_XPG3, + + _SC_XOPEN_XPG4, + + + _SC_CHAR_BIT, + + _SC_CHAR_MAX, + + _SC_CHAR_MIN, + + _SC_INT_MAX, + + _SC_INT_MIN, + + _SC_LONG_BIT, + + _SC_WORD_BIT, + + _SC_MB_LEN_MAX, + + _SC_NZERO, + + _SC_SSIZE_MAX, + + _SC_SCHAR_MAX, + + _SC_SCHAR_MIN, + + _SC_SHRT_MAX, + + _SC_SHRT_MIN, + + _SC_UCHAR_MAX, + + _SC_UINT_MAX, + + _SC_ULONG_MAX, + + _SC_USHRT_MAX, + + + _SC_NL_ARGMAX, + + _SC_NL_LANGMAX, + + _SC_NL_MSGMAX, + + _SC_NL_NMAX, + + _SC_NL_SETMAX, + + _SC_NL_TEXTMAX, + + + _SC_XBS5_ILP32_OFF32, + + _SC_XBS5_ILP32_OFFBIG, + + _SC_XBS5_LP64_OFF64, + + _SC_XBS5_LPBIG_OFFBIG, + + + _SC_XOPEN_LEGACY, + + _SC_XOPEN_REALTIME, + + _SC_XOPEN_REALTIME_THREADS, + + + _SC_ADVISORY_INFO, + + _SC_BARRIERS, + + _SC_BASE, + + _SC_C_LANG_SUPPORT, + + _SC_C_LANG_SUPPORT_R, + + _SC_CLOCK_SELECTION, + + _SC_CPUTIME, + + _SC_THREAD_CPUTIME, + + _SC_DEVICE_IO, + + _SC_DEVICE_SPECIFIC, + + _SC_DEVICE_SPECIFIC_R, + + _SC_FD_MGMT, + + _SC_FIFO, + + _SC_PIPE, + + _SC_FILE_ATTRIBUTES, + + _SC_FILE_LOCKING, + + _SC_FILE_SYSTEM, + + _SC_MONOTONIC_CLOCK, + + _SC_MULTI_PROCESS, + + _SC_SINGLE_PROCESS, + + _SC_NETWORKING, + + _SC_READER_WRITER_LOCKS, + + _SC_SPIN_LOCKS, + + _SC_REGEXP, + + _SC_REGEX_VERSION, + + _SC_SHELL, + + _SC_SIGNALS, + + _SC_SPAWN, + + _SC_SPORADIC_SERVER, + + _SC_THREAD_SPORADIC_SERVER, + + _SC_SYSTEM_DATABASE, + + _SC_SYSTEM_DATABASE_R, + + _SC_TIMEOUTS, + + _SC_TYPED_MEMORY_OBJECTS, + + _SC_USER_GROUPS, + + _SC_USER_GROUPS_R, + + _SC_2_PBS, + + _SC_2_PBS_ACCOUNTING, + + _SC_2_PBS_LOCATE, + + _SC_2_PBS_MESSAGE, + + _SC_2_PBS_TRACK, + + _SC_SYMLOOP_MAX, + + _SC_STREAMS, + + _SC_2_PBS_CHECKPOINT, + + + _SC_V6_ILP32_OFF32, + + _SC_V6_ILP32_OFFBIG, + + _SC_V6_LP64_OFF64, + + _SC_V6_LPBIG_OFFBIG, + + + _SC_HOST_NAME_MAX, + + _SC_TRACE, + + _SC_TRACE_EVENT_FILTER, + + _SC_TRACE_INHERIT, + + _SC_TRACE_LOG, + + + _SC_LEVEL1_ICACHE_SIZE, + + _SC_LEVEL1_ICACHE_ASSOC, + + _SC_LEVEL1_ICACHE_LINESIZE, + + _SC_LEVEL1_DCACHE_SIZE, + + _SC_LEVEL1_DCACHE_ASSOC, + + _SC_LEVEL1_DCACHE_LINESIZE, + + _SC_LEVEL2_CACHE_SIZE, + + _SC_LEVEL2_CACHE_ASSOC, + + _SC_LEVEL2_CACHE_LINESIZE, + + _SC_LEVEL3_CACHE_SIZE, + + _SC_LEVEL3_CACHE_ASSOC, + + _SC_LEVEL3_CACHE_LINESIZE, + + _SC_LEVEL4_CACHE_SIZE, + + _SC_LEVEL4_CACHE_ASSOC, + + _SC_LEVEL4_CACHE_LINESIZE, + + + + _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, + + _SC_RAW_SOCKETS, + + + _SC_V7_ILP32_OFF32, + + _SC_V7_ILP32_OFFBIG, + + _SC_V7_LP64_OFF64, + + _SC_V7_LPBIG_OFFBIG, + + + _SC_SS_REPL_MAX, + + + _SC_TRACE_EVENT_NAME_MAX, + + _SC_TRACE_NAME_MAX, + + _SC_TRACE_SYS_MAX, + + _SC_TRACE_USER_EVENT_MAX, + + + _SC_XOPEN_STREAMS, + + + _SC_THREAD_ROBUST_PRIO_INHERIT, + + _SC_THREAD_ROBUST_PRIO_PROTECT + + }; + + +enum + { + _CS_PATH, + + + _CS_V6_WIDTH_RESTRICTED_ENVS, + + + + _CS_GNU_LIBC_VERSION, + + _CS_GNU_LIBPTHREAD_VERSION, + + + _CS_V5_WIDTH_RESTRICTED_ENVS, + + + + _CS_V7_WIDTH_RESTRICTED_ENVS, + + + + _CS_LFS_CFLAGS = 1000, + + _CS_LFS_LDFLAGS, + + _CS_LFS_LIBS, + + _CS_LFS_LINTFLAGS, + + _CS_LFS64_CFLAGS, + + _CS_LFS64_LDFLAGS, + + _CS_LFS64_LIBS, + + _CS_LFS64_LINTFLAGS, + + + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, + + _CS_XBS5_ILP32_OFF32_LDFLAGS, + + _CS_XBS5_ILP32_OFF32_LIBS, + + _CS_XBS5_ILP32_OFF32_LINTFLAGS, + + _CS_XBS5_ILP32_OFFBIG_CFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LDFLAGS, + + _CS_XBS5_ILP32_OFFBIG_LIBS, + + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, + + _CS_XBS5_LP64_OFF64_CFLAGS, + + _CS_XBS5_LP64_OFF64_LDFLAGS, + + _CS_XBS5_LP64_OFF64_LIBS, + + _CS_XBS5_LP64_OFF64_LINTFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_CFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, + + _CS_XBS5_LPBIG_OFFBIG_LIBS, + + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V6_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFF32_LIBS, + + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V6_LP64_OFF64_CFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V6_LP64_OFF64_LIBS, + + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_POSIX_V7_ILP32_OFF32_CFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFF32_LIBS, + + _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_ILP32_OFFBIG_LIBS, + + _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, + + _CS_POSIX_V7_LP64_OFF64_CFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LDFLAGS, + + _CS_POSIX_V7_LP64_OFF64_LIBS, + + _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, + + _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, + + + _CS_V6_ENV, + + _CS_V7_ENV + + }; +# 613 "/usr/include/unistd.h" 2 3 4 + + +extern long int pathconf (const char *__path, int __name) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__)); + + +extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + +extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__)); +# 663 "/usr/include/unistd.h" 3 4 +extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ; +# 703 "/usr/include/unistd.h" 3 4 +extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ; +# 759 "/usr/include/unistd.h" 3 4 +extern __pid_t fork (void) __attribute__ ((__nothrow__)); + + + + + + + +extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ; + + + +extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int link (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int linkat (int __fromfd, const char *__from, int __tofd, + const char *__to, int __flags) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ; + + + + +extern int symlink (const char *__from, const char *__to) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ; + + + + +extern int symlinkat (const char *__from, int __tofd, + const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ; + + +extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ; + + + +extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern int unlinkat (int __fd, const char *__name, int __flag) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + +extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern char *getlogin (void); + + + + + + + +extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1))); + + + + +extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 874 "/usr/include/unistd.h" 3 4 +# 1 "/usr/include/getopt.h" 1 3 4 +# 57 "/usr/include/getopt.h" 3 4 +extern char *optarg; +# 71 "/usr/include/getopt.h" 3 4 +extern int optind; + + + + +extern int opterr; + + + +extern int optopt; +# 150 "/usr/include/getopt.h" 3 4 +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __attribute__ ((__nothrow__ , __leaf__)); +# 875 "/usr/include/unistd.h" 2 3 4 + + + + + + + +extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int sethostname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern int getdomainname (char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +extern int setdomainname (const char *__name, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + + + + +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__)); +extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + +extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int fsync (int __fd); +# 972 "/usr/include/unistd.h" 3 4 +extern long int gethostid (void); + + +extern void sync (void) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); + + + + +extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__)); +# 996 "/usr/include/unistd.h" 3 4 +extern int truncate (const char *__file, __off_t __length) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 1019 "/usr/include/unistd.h" 3 4 +extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ; +# 1040 "/usr/include/unistd.h" 3 4 +extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__)); +# 1061 "/usr/include/unistd.h" 3 4 +extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__)); +# 1084 "/usr/include/unistd.h" 3 4 +extern int lockf (int __fd, int __cmd, __off_t __len) ; +# 1115 "/usr/include/unistd.h" 3 4 +extern int fdatasync (int __fildes); +# 1154 "/usr/include/unistd.h" 3 4 + +# 29 "../../../server-code/src/common/utils.h" 2 +# 39 "../../../server-code/src/common/utils.h" + +# 39 "../../../server-code/src/common/utils.h" +void WriteDump(FILE* fp, const void* buffer, size_t length); +void ShowDump(const void* buffer, size_t length); + +void findfile(const char *p, const char *pat, void (func)(const char*)); + +# 43 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 43 "../../../server-code/src/common/utils.h" + exists(const char* filename); + + +unsigned int get_percentage(const unsigned int A, const unsigned int B); + +int64 apply_percentrate64(int64 value, int rate, int maxrate); +int apply_percentrate(int value, int rate, int maxrate); + +const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format); + + + + + +extern uint8 GetByte(uint32 val, int idx); +extern uint16 GetWord(uint32 val, int idx); +extern uint16 MakeWord(uint8 byte0, uint8 byte1); +extern uint32 MakeDWord(uint16 word0, uint16 word1); + + + + +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + +size_t hread(void * ptr, size_t size, size_t count, FILE * stream); +size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +# 83 "../../../server-code/src/common/utils.h" +struct HCache_interface { + void (*init) (void); + + +# 86 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 86 "../../../server-code/src/common/utils.h" + (*check) (const char *file); + FILE *(*open) (const char *file, const char *opt); + + time_t recompile_time; + +# 90 "../../../server-code/src/common/utils.h" 3 4 +_Bool +# 90 "../../../server-code/src/common/utils.h" + enabled; +}; + + +void HCache_defaults(void); + + +extern struct HCache_interface *HCache; +# 42 "../../../server-code/src/login/login.c" 2 + + +# 1 "/usr/include/stdlib.h" 1 3 4 +# 32 "/usr/include/stdlib.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 33 "/usr/include/stdlib.h" 2 3 4 + + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 1 3 4 +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 + +# 50 "/usr/include/x86_64-linux-gnu/bits/waitflags.h" 3 4 +typedef enum +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; +# 42 "/usr/include/stdlib.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 1 3 4 +# 66 "/usr/include/x86_64-linux-gnu/bits/waitstatus.h" 3 4 +union wait + { + int w_status; + struct + { + + unsigned int __w_termsig:7; + unsigned int __w_coredump:1; + unsigned int __w_retcode:8; + unsigned int:16; + + + + + + + + } __wait_terminated; + struct + { + + unsigned int __w_stopval:8; + unsigned int __w_stopsig:8; + unsigned int:16; + + + + + + + } __wait_stopped; + }; +# 43 "/usr/include/stdlib.h" 2 3 4 +# 67 "/usr/include/stdlib.h" 3 4 +typedef union + { + union wait *__uptr; + int *__iptr; + } __WAIT_STATUS __attribute__ ((__transparent_union__)); +# 95 "/usr/include/stdlib.h" 3 4 + + +typedef struct + { + int quot; + int rem; + } div_t; + + + +typedef struct + { + long int quot; + long int rem; + } ldiv_t; + + + + + + + +__extension__ typedef struct + { + long long int quot; + long long int rem; + } lldiv_t; + + +# 139 "/usr/include/stdlib.h" 3 4 +extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern double atof (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern int atoi (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + +extern long int atol (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +__extension__ extern long long int atoll (const char *__nptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + + +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +# 305 "/usr/include/stdlib.h" 3 4 +extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern long int a64l (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; + + + + +# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + + + + + + +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; + + + + +typedef __loff_t loff_t; + + + +typedef __ino_t ino_t; +# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __dev_t dev_t; +# 70 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __mode_t mode_t; + + + + +typedef __nlink_t nlink_t; +# 104 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __id_t id_t; +# 115 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; + + + + + +typedef __key_t key_t; +# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +# 200 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); +typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); +typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); +typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); + +typedef int register_t __attribute__ ((__mode__ (__word__))); +# 219 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/select.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/select.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/select.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 23 "/usr/include/x86_64-linux-gnu/bits/select.h" 2 3 4 +# 31 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/sigset.h" 3 4 +typedef int __sig_atomic_t; + + + + +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +# 34 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + + +typedef __sigset_t sigset_t; + + + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/time.h" 1 3 4 +# 30 "/usr/include/x86_64-linux-gnu/bits/time.h" 3 4 +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +# 46 "/usr/include/x86_64-linux-gnu/sys/select.h" 2 3 4 + + +typedef __suseconds_t suseconds_t; + + + + + +typedef long int __fd_mask; +# 64 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +typedef struct + { + + + + + + + __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))]; + + + } fd_set; + + + + + + +typedef __fd_mask fd_mask; +# 96 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 106 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +# 118 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# 131 "/usr/include/x86_64-linux-gnu/sys/select.h" 3 4 + +# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + +# 1 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 1 3 4 +# 24 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + + +__extension__ +extern unsigned int gnu_dev_major (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned int gnu_dev_minor (unsigned long long int __dev) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +__extension__ +extern unsigned long long int gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)); +# 58 "/usr/include/x86_64-linux-gnu/sys/sysmacros.h" 3 4 + +# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + + + +typedef __blksize_t blksize_t; + + + + + + +typedef __blkcnt_t blkcnt_t; + + + +typedef __fsblkcnt_t fsblkcnt_t; + + + +typedef __fsfilcnt_t fsfilcnt_t; +# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4 +# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4 +# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef unsigned long int pthread_t; + + +union pthread_attr_t +{ + char __size[56]; + long int __align; +}; + +typedef union pthread_attr_t pthread_attr_t; + + + + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; +# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + + unsigned int __nusers; + + + + int __kind; + + short __spins; + short __elision; + __pthread_list_t __list; +# 125 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + } __data; + char __size[40]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_mutexattr_t; + + + + +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[48]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_condattr_t; + + + +typedef unsigned int pthread_key_t; + + + +typedef int pthread_once_t; + + + + + +typedef union +{ + + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + signed char __rwelision; + + + + + unsigned char __pad1[7]; + + + unsigned long int __pad2; + + + unsigned int __flags; + + } __data; +# 220 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4 + char __size[56]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[8]; + long int __align; +} pthread_rwlockattr_t; + + + + + +typedef volatile int pthread_spinlock_t; + + + + +typedef union +{ + char __size[32]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[4]; + int __align; +} pthread_barrierattr_t; +# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4 + + + +# 315 "/usr/include/stdlib.h" 2 3 4 + + + + + + +extern long int random (void) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + + +extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +struct random_data + { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + +extern int rand (void) __attribute__ ((__nothrow__ , __leaf__)); + +extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int nrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__)); +extern long int jrand48 (unsigned short int __xsubi[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__)); +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +struct drand48_data + { + unsigned short int __x[3]; + unsigned short int __old_x[3]; + unsigned short int __c; + unsigned short int __init; + __extension__ unsigned long long int __a; + + }; + + +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))); + + + + + + + + + +extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + +extern void *calloc (size_t __nmemb, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + + + + +extern void *realloc (void *__ptr, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)); + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + + + +# 1 "/usr/include/alloca.h" 1 3 4 +# 24 "/usr/include/alloca.h" 3 4 +# 1 "/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h" 1 3 4 +# 25 "/usr/include/alloca.h" 2 3 4 + + + + + + + +extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +# 493 "/usr/include/stdlib.h" 2 3 4 + + + + + +extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + + + + +extern void *aligned_alloc (size_t __alignment, size_t __size) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ; + + + + +extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + +extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + + +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + +extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + + +extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); + + + + + + +extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; + +# 578 "/usr/include/stdlib.h" 3 4 +extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + +extern int setenv (const char *__name, const char *__value, int __replace) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))); + + +extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + + + + + +extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__)); +# 606 "/usr/include/stdlib.h" 3 4 +extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); +# 619 "/usr/include/stdlib.h" 3 4 +extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; +# 641 "/usr/include/stdlib.h" 3 4 +extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ; +# 662 "/usr/include/stdlib.h" 3 4 +extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 711 "/usr/include/stdlib.h" 3 4 + + + + + +extern int system (const char *__command) ; + +# 733 "/usr/include/stdlib.h" 3 4 +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + +typedef int (*__compar_fn_t) (const void *, const void *); +# 751 "/usr/include/stdlib.h" 3 4 + + + +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __attribute__ ((__nonnull__ (1, 2, 5))) ; + + + + + + + +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); +# 774 "/usr/include/stdlib.h" 3 4 +extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + +__extension__ extern long long int llabs (long long int __x) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + + + + +extern div_t div (int __numer, int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; +extern ldiv_t ldiv (long int __numer, long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + + + + +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ; + +# 811 "/usr/include/stdlib.h" 3 4 +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; + + + + +extern char *gcvt (double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ; + + + + +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5))); + + + + + + +extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + +extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + + +extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ; +# 898 "/usr/include/stdlib.h" 3 4 +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ; +# 950 "/usr/include/stdlib.h" 3 4 +extern int getloadavg (double __loadavg[], int __nelem) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + + +# 1 "/usr/include/x86_64-linux-gnu/bits/stdlib-float.h" 1 3 4 +# 955 "/usr/include/stdlib.h" 2 3 4 +# 967 "/usr/include/stdlib.h" 3 4 + +# 45 "../../../server-code/src/login/login.c" 2 + + +# 46 "../../../server-code/src/login/login.c" +struct login_interface login_s; +struct login_interface *login; +struct Login_Config login_config_; +struct mmo_char_server server[30]; + +struct Account_engine account_engine[] = { + {account_db_sql, +# 52 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 52 "../../../server-code/src/login/login.c" + } +}; + + +AccountDB* accounts = +# 56 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 56 "../../../server-code/src/login/login.c" + ; +# 66 "../../../server-code/src/login/login.c" +static struct DBData login_create_online_user(union DBKey key, va_list args) +{ + struct online_login_data* p; + ((p) = (struct online_login_data *) (iMalloc->calloc(((1)),(sizeof(struct online_login_data)),"../../../server-code/src/login/login.c", 69, __func__))); + p->account_id = key.i; + p->char_server = -1; + p->waiting_disconnect = (-1); + return DB->ptr2data(p); +} + +struct online_login_data* login_add_online_user(int char_server, int account_id) +{ + struct online_login_data* p; + p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(account_id),(login->create_online_user))) ); + p->char_server = char_server; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + return p; +} + +void login_remove_online_user(int account_id) +{ + struct online_login_data* p; + p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(account_id))) ); + if( p == +# 93 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 93 "../../../server-code/src/login/login.c" + ) + return; + if( p->waiting_disconnect != (-1) ) + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + + ( (login->online_db)->remove((login->online_db),DB->i2key(account_id), +# 98 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 98 "../../../server-code/src/login/login.c" +) ); +} + +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { + struct online_login_data* p = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(id))) ); + if( p != +# 103 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 103 "../../../server-code/src/login/login.c" + && p->waiting_disconnect == tid && p->account_id == id ) + { + p->waiting_disconnect = (-1); + login->remove_online_user(id); + ( (login->auth_db)->remove((login->auth_db),DB->i2key(id), +# 107 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 107 "../../../server-code/src/login/login.c" + ) ); + } + return 0; +} + + + + +static int login_online_db_setoffline(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data* p = DB->data2ptr(data); + int server_id = +# 118 "../../../server-code/src/login/login.c" 3 4 + __builtin_va_arg( +# 118 "../../../server-code/src/login/login.c" + ap +# 118 "../../../server-code/src/login/login.c" 3 4 + , +# 118 "../../../server-code/src/login/login.c" + int +# 118 "../../../server-code/src/login/login.c" 3 4 + ) +# 118 "../../../server-code/src/login/login.c" + ; + do { if (((void)(p), +# 119 "../../../server-code/src/login/login.c" 3 4 +0 +# 119 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if( server_id == -1 ) + { + p->char_server = -1; + if( p->waiting_disconnect != (-1) ) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } + else if( p->char_server == server_id ) + p->char_server = -2; + return 0; +} + + + + +static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct online_login_data *character= DB->data2ptr(data); + do { if (((void)(character), +# 140 "../../../server-code/src/login/login.c" 3 4 +0 +# 140 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if (character->char_server == -2) + login->remove_online_user(character->account_id); + return 0; +} + +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); + return 0; +} + + + + + +int charif_sendallwos(int sfd, uint8* buf, size_t len) +{ + int i, c; + + do { if (((void)(buf), +# 159 "../../../server-code/src/login/login.c" 3 4 +0 +# 159 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + for( i = 0, c = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + { + int fd = server[i].fd; + if (sockt->session_is_valid(fd) && fd != sfd) { + WFIFOHEAD(fd,len); + memcpy(WFIFOP(fd,0), buf, len); + WFIFOSET(fd,len); + ++c; + } + } + + return c; +} + + + +void chrif_server_init(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 178 "../../../server-code/src/login/login.c" 3 4 +0 +# 178 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 178, __func__, "id >= 0 && id < 30", "failed assertion"), +# 178 "../../../server-code/src/login/login.c" 3 4 +1 +# 178 "../../../server-code/src/login/login.c" +) )) return; } while(0); + memset(&server[id], 0, sizeof(server[id])); + server[id].fd = -1; +} + + + +void chrif_server_destroy(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 187 "../../../server-code/src/login/login.c" 3 4 +0 +# 187 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 187, __func__, "id >= 0 && id < 30", "failed assertion"), +# 187 "../../../server-code/src/login/login.c" 3 4 +1 +# 187 "../../../server-code/src/login/login.c" +) )) return; } while(0); + if (server[id].fd != -1) + { + sockt->close(server[id].fd); + server[id].fd = -1; + } +} + + + +void chrif_server_reset(int id) +{ + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + chrif_server_destroy(id); + chrif_server_init(id); +} + + + +void chrif_on_disconnect(int id) +{ + do { if (( (id >= 0 && id < 30) ? +# 208 "../../../server-code/src/login/login.c" 3 4 +0 +# 208 "../../../server-code/src/login/login.c" +: (nullpo->assert_report("../../../server-code/src/login/login.c", 208, __func__, "id >= 0 && id < 30", "failed assertion"), +# 208 "../../../server-code/src/login/login.c" 3 4 +1 +# 208 "../../../server-code/src/login/login.c" +) )) return; } while(0); + (showmsg->showStatus(("Char-server '%s' has disconnected.\n"), server[id].name)); + chrif_server_reset(id); +} + + + + + +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { + uint8 buf[2]; + (showmsg->showInfo(("IP Sync in progress...\n"))); + WBUFW(buf,0) = 0x2735; + charif_sendallwos(-1, buf, 2); + return 0; +} + + + + + + +# 229 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 229 "../../../server-code/src/login/login.c" + login_check_encrypted(const char* str1, const char* str2, const char* passwd) +{ + char tmpstr[64+1], md5str[32+1]; + + do { if (((void)(str1), +# 233 "../../../server-code/src/login/login.c" 3 4 +0 +# 233 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(str2), +# 234 "../../../server-code/src/login/login.c" 3 4 +0 +# 234 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(passwd), +# 235 "../../../server-code/src/login/login.c" 3 4 +0 +# 235 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + (strlib->safesnprintf_((tmpstr),(sizeof(tmpstr)),("%s%s"), str1, str2)); + MD5_String(tmpstr, md5str); + + return (0==strcmp(passwd, md5str)); +} + + +# 242 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 242 "../../../server-code/src/login/login.c" + login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +{ + do { if (((void)(passwd), +# 244 "../../../server-code/src/login/login.c" 3 4 +0 +# 244 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + do { if (((void)(refpass), +# 245 "../../../server-code/src/login/login.c" 3 4 +0 +# 245 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + if(passwdenc == PWENC_NONE) { + return (0==strcmp(passwd, refpass)); + } else { + + + + return ((passwdenc&PWENC_ENCRYPT) && login->check_encrypted(md5key, refpass, passwd)) || + ((passwdenc&PWENC_ENCRYPT2) && login->check_encrypted(refpass, md5key, passwd)); + } +} +# 265 "../../../server-code/src/login/login.c" +uint32 login_lan_subnet_check(uint32 ip) +{ + return sockt->lan_subnet_check(ip, +# 267 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 267 "../../../server-code/src/login/login.c" + ); +} + +void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +{ + WFIFOHEAD(fd,33); + WFIFOW(fd,0) = 0x2713; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = login_id1; + WFIFOL(fd,10) = login_id2; + WFIFOB(fd,14) = sex; + if (node) + { + WFIFOB(fd,15) = 0; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = node->version; + WFIFOB(fd,24) = node->clienttype; + WFIFOL(fd,25) = node->group_id; + WFIFOL(fd,29) = (unsigned int)node->expiration_time; + } + else + { + WFIFOB(fd,15) = 1; + WFIFOL(fd,16) = request_id; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + WFIFOL(fd,25) = 0; + WFIFOL(fd,29) = 0; + } + WFIFOSET(fd,33); +} + +void login_fromchar_parse_auth(int fd, int id, const char *const ip) +{ + struct login_auth_node* node; + + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + + int request_id = RFIFOL(fd,19); + RFIFOSKIP(fd,23); + + node = (struct login_auth_node*)( DB->data2ptr((login->auth_db)->get((login->auth_db),DB->i2key(account_id))) ); + if( core->runflag == LOGINSERVER_ST_RUNNING && + node != +# 313 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 313 "../../../server-code/src/login/login.c" + && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 && + node->sex == ( ((sex) == SEX_FEMALE) ? 'F' : ((sex) == SEX_MALE) ? 'M' : 'S' ) + ) + { + + + + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, node); + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(account_id), +# 325 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 325 "../../../server-code/src/login/login.c" + ) ); + } + else + { + do { if (((void)(ip), +# 329 "../../../server-code/src/login/login.c" 3 4 + 0 +# 329 "../../../server-code/src/login/login.c" + )) return; } while(0); + (showmsg->showStatus(("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, +# 331 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 331 "../../../server-code/src/login/login.c" + ); + } +} + +void login_fromchar_parse_update_users(int fd, int id) +{ + int users = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + + if( server[id].users != users ) + { + (showmsg->showStatus(("set users %s : %d\n"), server[id].name, users)); + + server[id].users = (uint16)users; + } +} + +void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((email),(RFIFOP(fd,6)),(40))); (strlib->remove_control_chars_(email)); + RFIFOSKIP(fd,46); + + if( (strlib->e_mail_check_(email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) || strcmp(acc.email, "a@a.com") == 0 || acc.email[0] == '\0' ) + (showmsg->showNotice(("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - account doesn't exist or e-mail of account isn't default e-mail (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else { + memcpy(acc.email, email, sizeof(acc.email)); + (showmsg->showNotice(("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"), server[id].name, account_id, email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +{ + WFIFOHEAD(fd,72); + WFIFOW(fd,0) = 0x2717; + WFIFOL(fd,2) = account_id; + if (acc) + { + time_t expiration_time = 0; + char email[40] = ""; + int group_id = 0; + uint8 char_slots = 0; + char birthdate[10+1] = ""; + char pincode[4+1] = "\0\0\0\0"; + + (strlib->safestrncpy_((email),(acc->email),(sizeof(email)))); + expiration_time = acc->expiration_time; + group_id = acc->group_id; + char_slots = acc->char_slots; + (strlib->safestrncpy_((pincode),(acc->pincode),(sizeof(pincode)))); + (strlib->safestrncpy_((birthdate),(acc->birthdate),(sizeof(birthdate)))); + if (pincode[0] == '\0') + memset(pincode,'\0',sizeof(pincode)); + + (strlib->safestrncpy_((WFIFOP(fd,6)),(email),(40))); + WFIFOL(fd,46) = (uint32)expiration_time; + WFIFOB(fd,50) = (unsigned char)group_id; + WFIFOB(fd,51) = char_slots; + (strlib->safestrncpy_((WFIFOP(fd,52)),(birthdate),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),(pincode),(4+1))); + WFIFOL(fd,68) = acc->pincode_change; + } + else + { + (strlib->safestrncpy_((WFIFOP(fd,6)),(""),(40))); + WFIFOL(fd,46) = 0; + WFIFOB(fd,50) = 0; + WFIFOB(fd,51) = 0; + (strlib->safestrncpy_((WFIFOP(fd,52)),(""),(10+1))); + (strlib->safestrncpy_((WFIFOP(fd,63)),("\0\0\0\0"),(4+1))); + WFIFOL(fd,68) = 0; + } + WFIFOSET(fd,72); +} + +void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + { + (showmsg->showNotice(("Char-server '%s': account %d NOT found (ip: %s).\n"), server[id].name, account_id, ip)); + login->fromchar_account(fd, account_id, +# 425 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 425 "../../../server-code/src/login/login.c" + ); + } + else { + login->fromchar_account(fd, account_id, &acc); + } +} + +void login_fromchar_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2718; + WFIFOSET(fd,2); +} + +void login_fromchar_parse_ping(int fd) +{ + RFIFOSKIP(fd,2); + login->fromchar_pong(fd); +} + +void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + char actual_email[40]; + char new_email[40]; + + int account_id = RFIFOL(fd,2); + (strlib->safestrncpy_((actual_email),(RFIFOP(fd,6)),(40))); + (strlib->safestrncpy_((new_email),(RFIFOP(fd,46)),(40))); + RFIFOSKIP(fd, 86); + + if( (strlib->e_mail_check_(actual_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( (strlib->e_mail_check_(new_email)) == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(new_email, "a@a.com") == 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"), server[id].name, account_id, ip)); + else + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but account doesn't exist (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( strcasecmp(acc.email, actual_email) != 0 ) + (showmsg->showNotice(("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, acc.email, actual_email, ip)); + else { + (strlib->safestrncpy_((acc.email),(new_email),(sizeof(acc.email)))); + (showmsg->showNotice(("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"), server[id].name, account_id, acc.userid, new_email, ip)); + + accounts->save(accounts, &acc); + } +} + +void login_fromchar_account_update_other(int account_id, unsigned int state) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 0; + WBUFL(buf,7) = state; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + unsigned int state = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else + if( acc.state == state ) + (showmsg->showNotice(("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + else { + (showmsg->showNotice(("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n"), server[id].name, account_id, state, ip)); + + acc.state = state; + + accounts->save(accounts, &acc); + + + if (state != 0) { + login->fromchar_account_update_other(account_id, state); + } + } +} + +void login_fromchar_ban(int account_id, time_t timestamp) +{ + uint8 buf[11]; + WBUFW(buf,0) = 0x2731; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = 1; + WBUFL(buf,7) = (uint32)timestamp; + charif_sendallwos(-1, buf, 11); +} + +void login_fromchar_parse_ban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + int year = RFIFOW(fd,6); + int month = RFIFOW(fd,8); + int mday = RFIFOW(fd,10); + int hour = RFIFOW(fd,12); + int min = RFIFOW(fd,14); + int sec = RFIFOW(fd,16); + RFIFOSKIP(fd,18); + + if (!accounts->load_num(accounts, &acc, account_id)) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + time_t timestamp; + struct tm *tmtime; + if (acc.unban_time == 0 || acc.unban_time < time( +# 543 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 543 "../../../server-code/src/login/login.c" + )) + timestamp = time( +# 544 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 544 "../../../server-code/src/login/login.c" + ); + else + timestamp = acc.unban_time; + tmtime = localtime(×tamp); + tmtime->tm_year += year; + tmtime->tm_mon += month; + tmtime->tm_mday += mday; + tmtime->tm_hour += hour; + tmtime->tm_min += min; + tmtime->tm_sec += sec; + timestamp = mktime(tmtime); + if (timestamp == -1) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"), server[id].name, account_id, ip)); + } else if( timestamp <= time( +# 557 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 557 "../../../server-code/src/login/login.c" + ) || timestamp == 0 ) { + (showmsg->showNotice(("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"), server[id].name, account_id, ip)); + } else { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login->config->date_format); + (showmsg->showNotice(("Char-server '%s': Ban request (account: %d, new final date of banishment: %ld (%s), ip: %s).\n"), server[id].name, account_id, (long)timestamp, tmpstr, ip)) + ; + + acc.unban_time = timestamp; + + + accounts->save(accounts, &acc); + + login->fromchar_ban(account_id, timestamp); + } + } +} + +void login_fromchar_change_sex_other(int account_id, char sex) +{ + unsigned char buf[7]; + WBUFW(buf,0) = 0x2723; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = ( ((sex) == 'F') ? SEX_FEMALE : ((sex) == 'M') ? SEX_MALE : SEX_SERVER ); + charif_sendallwos(-1, buf, 7); +} + +void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.sex == 'S' ) + (showmsg->showNotice(("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; + + (showmsg->showNotice(("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"), server[id].name, account_id, sex, ip)); + + acc.sex = sex; + + accounts->save(accounts, &acc); + + + login->fromchar_change_sex_other(account_id, sex); + } +} + +void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,4); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showStatus(("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else { + mmo_save_accreg2(accounts,fd,account_id,RFIFOL(fd, 8)); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void login_fromchar_parse_unban(int fd, int id, const char *const ip) +{ + struct mmo_account acc; + + int account_id = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + if( !accounts->load_num(accounts, &acc, account_id) ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d not found, ip: %s).\n"), server[id].name, account_id, ip)); + else + if( acc.unban_time == 0 ) + (showmsg->showNotice(("Char-server '%s': Error of Unban request (account: %d, no change for unban date, ip: %s).\n"), server[id].name, account_id, ip)); + else + { + (showmsg->showNotice(("Char-server '%s': Unban request (account: %d, ip: %s).\n"), server[id].name, account_id, ip)); + acc.unban_time = 0; + accounts->save(accounts, &acc); + } +} + +void login_fromchar_parse_account_online(int fd, int id) +{ + login->add_online_user(id, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_account_offline(int fd) +{ + login->remove_online_user(RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_online_accounts(int fd, int id) +{ + uint32 i, users; + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + users = RFIFOW(fd,4); + for (i = 0; i < users; i++) { + int aid = RFIFOL(fd,6+i*4); + struct online_login_data *p = ( DB->data2ptr((login->online_db)->ensure((login->online_db),DB->i2key(aid),(login->create_online_user))) ); + p->char_server = id; + if (p->waiting_disconnect != (-1)) + { + timer->delete(p->waiting_disconnect, login->waiting_disconnect_timer); + p->waiting_disconnect = (-1); + } + } +} + +void login_fromchar_parse_request_account_reg2(int fd) +{ + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + RFIFOSKIP(fd,10); + + mmo_send_accreg2(accounts,fd,account_id,char_id); +} + +void login_fromchar_parse_update_wan_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd,2)); + (showmsg->showInfo(("Updated IP of Server #%d to %u.%u.%u.%u.\n"),id, CONVIP(server[id].ip))); + RFIFOSKIP(fd,6); +} + +void login_fromchar_parse_all_offline(int fd, int id) +{ + (showmsg->showInfo(("Setting accounts from char-server %d offline.\n"), id)); + login->online_db->foreach(login->online_db, login->online_db_setoffline, id); + RFIFOSKIP(fd,2); +} + +void login_fromchar_parse_change_pincode(int fd) +{ + struct mmo_account acc; + + if (accounts->load_num(accounts, &acc, RFIFOL(fd,2))) { + (strlib->safestrncpy_((acc.pincode),(RFIFOP(fd,6)),(sizeof(acc.pincode)))); + acc.pincode_change = ((unsigned int)time( +# 703 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 703 "../../../server-code/src/login/login.c" + )); + accounts->save(accounts, &acc); + } + RFIFOSKIP(fd,11); +} + + +# 709 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 709 "../../../server-code/src/login/login.c" + login_fromchar_parse_wrong_pincode(int fd) +{ + struct mmo_account acc; + + if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) { + struct online_login_data* ld = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(acc.account_id))) ); + + if (ld == +# 716 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 716 "../../../server-code/src/login/login.c" + ) { + RFIFOSKIP(fd,6); + return +# 718 "../../../server-code/src/login/login.c" 3 4 + 1 +# 718 "../../../server-code/src/login/login.c" + ; + } + + login_log(sockt->host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed"); + } + + login->remove_online_user(acc.account_id); + RFIFOSKIP(fd,6); + return +# 726 "../../../server-code/src/login/login.c" 3 4 + 0 +# 726 "../../../server-code/src/login/login.c" + ; +} + +void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +{ + if (acc) + { + WFIFOHEAD(fd,183); + WFIFOW(fd,0) = 0x2737; + (strlib->safestrncpy_((WFIFOP(fd,2)),(acc->userid),((23 + 1)))); + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,26)),(acc->pass),(33))); + else + memset(WFIFOP(fd,26), '\0', 33); + (strlib->safestrncpy_((WFIFOP(fd,59)),(acc->email),(40))); + (strlib->safestrncpy_((WFIFOP(fd,99)),(acc->last_ip),(16))); + WFIFOL(fd,115) = acc->group_id; + (strlib->safestrncpy_((WFIFOP(fd,119)),(acc->lastlogin),(24))); + WFIFOL(fd,143) = acc->logincount; + WFIFOL(fd,147) = acc->state; + if (u_group >= acc->group_id) + (strlib->safestrncpy_((WFIFOP(fd,151)),(acc->pincode),(5))); + else + memset(WFIFOP(fd,151), '\0', 5); + (strlib->safestrncpy_((WFIFOP(fd,156)),(acc->birthdate),(11))); + WFIFOL(fd,167) = map_fd; + WFIFOL(fd,171) = u_fd; + WFIFOL(fd,175) = u_aid; + WFIFOL(fd,179) = account_id; + WFIFOSET(fd,183); + } + else + { + WFIFOHEAD(fd,18); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = map_fd; + WFIFOL(fd,6) = u_fd; + WFIFOL(fd,10) = u_aid; + WFIFOL(fd,14) = account_id; + WFIFOSET(fd,18); + } +} + +void login_fromchar_parse_accinfo(int fd) +{ + struct mmo_account acc; + int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); + if (accounts->load_num(accounts, &acc, account_id)) { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, &acc); + } else { + login->fromchar_accinfo(fd, account_id, u_fd, u_aid, u_group, map_fd, +# 776 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 776 "../../../server-code/src/login/login.c" + ); + } + RFIFOSKIP(fd,22); +} + + + + +int login_parse_fromchar(int fd) +{ + int id; + uint32 ipl; + char ip[16]; + + do { for ((id) = (0); (id) < (( (int)(sizeof(server)/sizeof((server)[0])) )); ++(id)) if (server[id].fd == fd) break; } while( +# 790 "../../../server-code/src/login/login.c" 3 4 +0 +# 790 "../../../server-code/src/login/login.c" +); + if( id == ( (int)(sizeof(server)/sizeof((server)[0])) ) ) + { + (showmsg->showDebug(("login_parse_fromchar: Disconnecting invalid session #%d (is not a char-server)\n"), fd)); + sockt->eof(fd); + sockt->close(fd); + return 0; + } + + if( sockt->session[fd]->flag.eof ) + { + sockt->close(fd); + server[id].fd = -1; + chrif_on_disconnect(id); + return 0; + } + + ipl = server[id].ip; + sockt->ip2str(ipl, ip); + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_FromChar])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_FromChar); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x2712: + if( RFIFOREST(fd) < 23 ) + return 0; + { + login->fromchar_parse_auth(fd, id, ip); + } + break; + + case 0x2714: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_update_users(fd, id); + } + break; + + case 0x2715: + if (RFIFOREST(fd) < 46) + return 0; + { + login->fromchar_parse_request_change_email(fd, id, ip); + } + break; + + case 0x2716: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_account_data(fd, id, ip); + } + break; + + case 0x2719: + login->fromchar_parse_ping(fd); + break; + + + case 0x2722: + if (RFIFOREST(fd) < 86) + return 0; + { + login->fromchar_parse_change_email(fd, id, ip); + } + break; + + case 0x2724: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_account_update(fd, id, ip); + } + break; + + case 0x2725: + if (RFIFOREST(fd) < 18) + return 0; + { + login->fromchar_parse_ban(fd, id, ip); + } + break; + + case 0x2727: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_change_sex(fd, id, ip); + } + break; + + case 0x2728: + if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) ) + return 0; + { + login->fromchar_parse_account_reg2(fd, id, ip); + } + break; + + case 0x272a: + if( RFIFOREST(fd) < 6 ) + return 0; + { + login->fromchar_parse_unban(fd, id, ip); + } + break; + + case 0x272b: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_online(fd, id); + break; + + case 0x272c: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_account_offline(fd); + break; + + case 0x272d: + if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) + return 0; + { + login->fromchar_parse_online_accounts(fd, id); + } + RFIFOSKIP(fd,RFIFOW(fd,2)); + break; + + case 0x272e: + if (RFIFOREST(fd) < 10) + return 0; + { + login->fromchar_parse_request_account_reg2(fd); + } + break; + + case 0x2736: + if( RFIFOREST(fd) < 6 ) + return 0; + login->fromchar_parse_update_wan_ip(fd, id); + break; + + case 0x2737: + login->fromchar_parse_all_offline(fd, id); + break; + + case 0x2738: + if( RFIFOREST(fd) < 11 ) + return 0; + else { + login->fromchar_parse_change_pincode(fd); + } + break; + + case 0x2739: + if( RFIFOREST(fd) < 6 ) + return 0; + else { + if (login->fromchar_parse_wrong_pincode(fd)) + return 0; + } + break; + + case 0x2740: + if( RFIFOREST(fd) < 22 ) + return 0; + else { + login->fromchar_parse_accinfo(fd); + } + break; + default: + (showmsg->showError(("login_parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n"), command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + + + + +int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { + static int num_regs = 0; + static int64 new_reg_tick = 0; + int64 tick = timer->gettick(); + struct mmo_account acc; + + do { if (((void)(userid), +# 991 "../../../server-code/src/login/login.c" 3 4 +0 +# 991 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(pass), +# 992 "../../../server-code/src/login/login.c" 3 4 +0 +# 992 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + do { if (((void)(last_ip), +# 993 "../../../server-code/src/login/login.c" 3 4 +0 +# 993 "../../../server-code/src/login/login.c" +)) return(3); } while(0); + + if( new_reg_tick == 0 ) + new_reg_tick = timer->gettick(); + if (((tick)-(new_reg_tick)) < 0 && num_regs >= login->config->allowed_regs) { + (showmsg->showNotice(("Account registration denied (registration limit exceeded)\n"))); + return 3; + } + + if (login->config->new_acc_length_limit && (strlen(userid) < 4 || strlen(pass) < 4)) + return 1; + + + if( sex != 'M' && sex != 'F' ) + return 0; + + + if( accounts->load_str(accounts, &acc, userid) ) { + (showmsg->showNotice(("Attempt of creation of an already existing account (account: %s_%c, pass: %s, received pass: %s)\n"), userid, sex, acc.pass, pass)); + return 1; + } + + memset(&acc, '\0', sizeof(acc)); + acc.account_id = -1; + (strlib->safestrncpy_((acc.userid),(userid),(sizeof(acc.userid)))); + (strlib->safestrncpy_((acc.pass),(pass),(sizeof(acc.pass)))); + acc.sex = sex; + (strlib->safestrncpy_((acc.email),("a@a.com"),(sizeof(acc.email)))); + acc.expiration_time = (login->config->start_limited_time != -1) ? time( +# 1021 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1021 "../../../server-code/src/login/login.c" + ) + login->config->start_limited_time : 0; + (strlib->safestrncpy_((acc.lastlogin),("0000-00-00 00:00:00"),(sizeof(acc.lastlogin)))); + (strlib->safestrncpy_((acc.last_ip),(last_ip),(sizeof(acc.last_ip)))); + (strlib->safestrncpy_((acc.birthdate),("0000-00-00"),(sizeof(acc.birthdate)))); + (strlib->safestrncpy_((acc.pincode),("\0"),(sizeof(acc.pincode)))); + acc.pincode_change = 0; + acc.char_slots = 0; + + if( !accounts->create(accounts, &acc) ) + return 0; + + (showmsg->showNotice(("Account creation (account %s, id: %d, pass: %s, sex: %c)\n"), acc.userid, acc.account_id, acc.pass, acc.sex)); + + if( ((tick)-(new_reg_tick)) > 0 ) { + num_regs = 0; + new_reg_tick = tick + login->config->time_allowed*1000; + } + ++num_regs; + + return -1; +} + + + + + +int login_mmo_auth(struct login_session_data* sd, +# 1047 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1047 "../../../server-code/src/login/login.c" + isServer) { + struct mmo_account acc; + size_t len; + + char ip[16]; + do { if (((void)(sd), +# 1052 "../../../server-code/src/login/login.c" 3 4 +0 +# 1052 "../../../server-code/src/login/login.c" +)) return(0); } while(0); + sockt->ip2str(sockt->session[sd->fd]->client_addr, ip); + + + if (login->config->use_dnsbl) { + char r_ip[16]; + char ip_dnsbl[256]; + char* dnsbl_serv; + uint8* sin_addr = (uint8*)&sockt->session[sd->fd]->client_addr; + + sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); + + for (dnsbl_serv = strtok(login->config->dnsbl_servs,","); dnsbl_serv != +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ; dnsbl_serv = strtok( +# 1064 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1064 "../../../server-code/src/login/login.c" + ,",")) { + sprintf(ip_dnsbl, "%s.%s", r_ip, (strlib->trim_(dnsbl_serv))); + if (sockt->host2ip(ip_dnsbl)) { + (showmsg->showInfo(("DNSBL: (%s) Blacklisted. User Kicked.\n"), r_ip)); + return 3; + } + } + + } + + + if (login->config->check_client_version && sd->version != login->config->client_version_to_connect) + return 5; + + len = (strlib->strnlen_((sd->userid),((23 + 1)))); + + + if (login->config->new_account_flag) { + if (len > 2 && sd->passwd[0] != '\0' && + sd->passwdenc == PWENC_NONE && + sd->userid[len-2] == '_' && memchr("FfMm", sd->userid[len-1], 4)) + { + int result; + + + len -= 2; + sd->userid[len] = '\0'; + + result = login->mmo_auth_new(sd->userid, sd->passwd, (toupper((unsigned char)(sd->userid[len+1]))), ip); + if( result != -1 ) + return result; + } + } + + if( len <= 0 ) { + (showmsg->showNotice(("Empty userid (received pass: '%s', ip: %s)\n"), sd->passwd, ip)); + return 0; + } + + if( !accounts->load_str(accounts, &acc, sd->userid) ) { + (showmsg->showNotice(("Unknown account (account: %s, received pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 0; + } + + if( !login->check_password(sd->md5key, sd->passwdenc, sd->passwd, acc.pass) ) { + (showmsg->showNotice(("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n"), sd->userid, acc.pass, sd->passwd, ip)); + return 1; + } + + if( acc.unban_time != 0 && acc.unban_time > time( +# 1113 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1113 "../../../server-code/src/login/login.c" + ) ) { + char tmpstr[24]; + timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login->config->date_format); + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n"), sd->userid, sd->passwd, tmpstr, ip)); + return 6; + } + + if( acc.state != 0 ) { + (showmsg->showNotice(("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n"), sd->userid, sd->passwd, acc.state, ip)); + return acc.state - 1; + } + + if (login->config->client_hash_check && !isServer) { + struct client_hash_node *node = +# 1126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1126 "../../../server-code/src/login/login.c" + ; + +# 1127 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1127 "../../../server-code/src/login/login.c" + match = +# 1127 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1127 "../../../server-code/src/login/login.c" + ; + + for (node = login->config->client_hash_nodes; node; node = node->next) { + if( acc.group_id < node->group_id ) + continue; + if( *node->hash == '\0' + || (sd->has_client_hash && memcmp(node->hash, sd->client_hash, 16) == 0 ) + ) { + match = +# 1135 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1135 "../../../server-code/src/login/login.c" + ; + break; + } + } + + if( !match ) { + char smd5[33]; + int i; + + if( !sd->has_client_hash ) { + (showmsg->showNotice(("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n"), sd->userid, sd->passwd, ip)); + return 5; + } + + for( i = 0; i < 16; i++ ) + sprintf(&smd5[i * 2], "%02x", sd->client_hash[i]); + smd5[32] = '\0'; + + (showmsg->showNotice(("Invalid client hash (account: %s, pass: %s, sent md5: %s, ip: %s)\n"), sd->userid, sd->passwd, smd5, ip)); + return 5; + } + } + + (showmsg->showNotice(("Authentication accepted (account: %s, id: %d, ip: %s)\n"), sd->userid, acc.account_id, ip)); + + + sd->account_id = acc.account_id; + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; + (strlib->safestrncpy_((sd->lastlogin),(acc.lastlogin),(sizeof(sd->lastlogin)))); + sd->sex = acc.sex; + sd->group_id = (uint8)acc.group_id; + sd->expiration_time = acc.expiration_time; + + + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time( +# 1170 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1170 "../../../server-code/src/login/login.c" + ), "%Y-%m-%d %H:%M:%S"); + (strlib->safestrncpy_((acc.last_ip),(ip),(sizeof(acc.last_ip)))); + acc.unban_time = 0; + acc.logincount++; + + accounts->save(accounts, &acc); + + if( sd->sex != 'S' && sd->account_id < 2000000 ) + (showmsg->showWarning(("Account %s has account id %d! Account IDs must be over %d to work properly!\n"), sd->userid, sd->account_id, 2000000)); + + return -1; +} + +void login_connection_problem(int fd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_kick(struct login_session_data* sd) +{ + uint8 buf[6]; + do { if (((void)(sd), +# 1194 "../../../server-code/src/login/login.c" 3 4 +0 +# 1194 "../../../server-code/src/login/login.c" +)) return; } while(0); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = sd->account_id; + charif_sendallwos(-1, buf, 6); +} + +void login_auth_ok(struct login_session_data* sd) +{ + int fd = 0; + uint32 ip; + uint8 server_num, n; + struct login_auth_node* node; + int i; + + do { if (((void)(sd), +# 1208 "../../../server-code/src/login/login.c" 3 4 +0 +# 1208 "../../../server-code/src/login/login.c" +)) return; } while(0); + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if( core->runflag != LOGINSERVER_ST_RUNNING ) + { + + login->connection_problem(fd, 1); + return; + } + + if (login->config->group_id_to_connect >= 0 && sd->group_id != login->config->group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n"), login->config->group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } else if (login->config->min_group_id_to_connect >= 0 && login->config->group_id_to_connect == -1 && sd->group_id < login->config->min_group_id_to_connect) { + (showmsg->showStatus(("Connection refused: the minimum group id required for connection is %d (account: %s, group: %d).\n"), login->config->min_group_id_to_connect, sd->userid, sd->group_id)); + login->connection_problem(fd, 1); + return; + } + + server_num = 0; + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + if (sockt->session_is_active(server[i].fd)) + server_num++; + + if( server_num == 0 ) + { + (showmsg->showStatus(("Connection refused: there is no char-server online (account: %s).\n"), sd->userid)); + login->connection_problem(fd, 1); + return; + } + + { + struct online_login_data* data = (struct online_login_data*)( DB->data2ptr((login->online_db)->get((login->online_db),DB->i2key(sd->account_id))) ); + if( data ) + { + if( data->char_server > -1 ) + { + (showmsg->showNotice(("User '%s' is already online - Rejected.\n"), sd->userid)); + login->kick(sd); + if( data->waiting_disconnect == (-1) ) + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + + login->connection_problem(fd, 8); + return; + } + else + if( data->char_server == -1 ) + { + + ( (login->auth_db)->remove((login->auth_db),DB->i2key(sd->account_id), +# 1258 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1258 "../../../server-code/src/login/login.c" + ) ); + login->remove_online_user(sd->account_id); + data = +# 1260 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1260 "../../../server-code/src/login/login.c" + ; + } + } + } + + login_log(ip, sd->userid, 100, "login ok"); + (showmsg->showStatus(("Connection of the account '%s' accepted.\n"), sd->userid)); + + WFIFOHEAD(fd,47+32*server_num); + WFIFOW(fd,0) = 0x69; + WFIFOW(fd,2) = 47+32*server_num; + WFIFOL(fd,4) = sd->login_id1; + WFIFOL(fd,8) = sd->account_id; + WFIFOL(fd,12) = sd->login_id2; + WFIFOL(fd,16) = 0; + + memset(WFIFOP(fd,20), 0, 24); + WFIFOW(fd,44) = 0; + WFIFOB(fd,46) = ( ((sd->sex) == 'F') ? SEX_FEMALE : ((sd->sex) == 'M') ? SEX_MALE : SEX_SERVER ); + for (i = 0, n = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i) { + uint32 subnet_char_ip; + + if (!sockt->session_is_valid(server[i].fd)) + continue; + + subnet_char_ip = login->lan_subnet_check(ip); + WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); + memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); + WFIFOW(fd,47+n*32+26) = server[i].users; + + if( server[i].type == CST_PAYING && sd->expiration_time > time( +# 1291 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1291 "../../../server-code/src/login/login.c" + ) ) + WFIFOW(fd,47+n*32+28) = CST_NORMAL; + else + WFIFOW(fd,47+n*32+28) = server[i].type; + + WFIFOW(fd,47+n*32+30) = server[i].new_; + n++; + } + WFIFOSET(fd,47+32*server_num); + + + ((node) = (struct login_auth_node *) (iMalloc->calloc(((1)),(sizeof(struct login_auth_node)),"../../../server-code/src/login/login.c", 1302, __func__))); + node->account_id = sd->account_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->ip = ip; + node->version = sd->version; + node->clienttype = sd->clienttype; + node->group_id = sd->group_id; + node->expiration_time = sd->expiration_time; + ( (login->auth_db)->put((login->auth_db),DB->i2key(sd->account_id),DB->ptr2data(node), +# 1312 "../../../server-code/src/login/login.c" 3 4 +((void *)0) +# 1312 "../../../server-code/src/login/login.c" +) ); + + { + struct online_login_data* data; + + + data = login->add_online_user(-1, sd->account_id); + + + data->waiting_disconnect = timer->add(timer->gettick()+30000, login->waiting_disconnect_timer, sd->account_id, 0); + } +} + +void login_auth_failed(struct login_session_data* sd, int result) +{ + int fd; + uint32 ip; + do { if (((void)(sd), +# 1329 "../../../server-code/src/login/login.c" 3 4 +0 +# 1329 "../../../server-code/src/login/login.c" +)) return; } while(0); + + fd = sd->fd; + ip = sockt->session[fd]->client_addr; + if (login->config->log_login) { + const char* error; + switch( result ) { + case 0: error = "Unregistered ID."; break; + case 1: error = "Incorrect Password."; break; + case 2: error = "Account Expired."; break; + case 3: error = "Rejected from server."; break; + case 4: error = "Blocked by GM."; break; + case 5: error = "Not latest game EXE."; break; + case 6: error = "Banned."; break; + case 7: error = "Server Over-population."; break; + case 8: error = "Account limit from company"; break; + case 9: error = "Ban by DBA"; break; + case 10: error = "Email not confirmed"; break; + case 11: error = "Ban by GM"; break; + case 12: error = "Working in DB"; break; + case 13: error = "Self Lock"; break; + case 14: error = "Not Permitted Group"; break; + case 15: error = "Not Permitted Group"; break; + case 99: error = "Account gone."; break; + case 100: error = "Login info remains."; break; + case 101: error = "Hacking investigation."; break; + case 102: error = "Bug investigation."; break; + case 103: error = "Deleting char."; break; + case 104: error = "Deleting spouse char."; break; + default : error = "Unknown Error."; break; + } + + login_log(ip, sd->userid, result, error); + } + + if (result == 1 && login->config->dynamic_pass_failure_ban && !sockt->trusted_ip_check(ip)) + ipban_log(ip); + + + WFIFOHEAD(fd,26); + WFIFOW(fd,0) = 0x83e; + WFIFOL(fd,2) = result; + if( result != 6 ) + memset(WFIFOP(fd,6), '\0', 20); + else { + struct mmo_account acc; + time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0; + timestamp2string(WFIFOP(fd,6), 20, unban_time, login->config->date_format); + } + WFIFOSET(fd,26); +# 1392 "../../../server-code/src/login/login.c" +} + +void login_login_error(int fd, uint8 status) +{ + WFIFOHEAD(fd,23); + WFIFOW(fd,0) = 0x6a; + WFIFOB(fd,2) = status; + WFIFOSET(fd,23); +} + +void login_parse_ping(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_ping(int fd, struct login_session_data* sd) +{ + RFIFOSKIP(fd,26); +} + +void login_parse_client_md5(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_client_md5(int fd, struct login_session_data* sd) +{ + sd->has_client_hash = 1; + memcpy(sd->client_hash, RFIFOP(fd, 2), 16); + + RFIFOSKIP(fd,18); +} + + +# 1417 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1417 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) __attribute__((nonnull (2))); + +# 1418 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1418 "../../../server-code/src/login/login.c" + login_parse_client_login(int fd, struct login_session_data* sd, const char *const ip) +{ + uint32 version; + char username[(23 + 1)]; + char password[(32+1)]; + unsigned char passhash[16]; + uint8 clienttype; + int result; + uint16 command = RFIFOW(fd,0); + +# 1427 "../../../server-code/src/login/login.c" 3 4 +_Bool +# 1427 "../../../server-code/src/login/login.c" + israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825); + + + if(command == 0x0825) + { + const char *accname = RFIFOP(fd, 9); + const char *token = RFIFOP(fd, 0x5C); + size_t uAccLen = strlen(accname); + size_t uTokenLen = RFIFOREST(fd) - 0x5C; + + version = RFIFOL(fd,4); + + if(uAccLen <= 0 || uTokenLen <= 0) { + login->auth_failed(sd, 3); + return +# 1441 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1441 "../../../server-code/src/login/login.c" + ; + } + + (strlib->safestrncpy_((username),(accname),((23 + 1)))); + (strlib->safestrncpy_((password),(token),((((uTokenLen+1) < ((32+1))) ? (uTokenLen+1) : ((32+1)))))); + clienttype = RFIFOB(fd, 8); + } + else + { + version = RFIFOL(fd,2); + (strlib->safestrncpy_((username),(RFIFOP(fd,6)),((23 + 1)))); + if( israwpass ) + { + (strlib->safestrncpy_((password),(RFIFOP(fd,30)),((23 + 1)))); + clienttype = RFIFOB(fd,54); + } + else + { + memcpy(passhash, RFIFOP(fd,30), 16); + clienttype = RFIFOB(fd,46); + } + } + RFIFOSKIP(fd,RFIFOREST(fd)); + + sd->clienttype = clienttype; + sd->version = version; + (strlib->safestrncpy_((sd->userid),(username),((23 + 1)))); + if( israwpass ) + { + (showmsg->showStatus(("Request for connection of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->safestrncpy_((sd->passwd),(password),((32+1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + } + else + { + (showmsg->showStatus(("Request for connection (passwdenc mode) of %s (ip: %s).\n"), sd->userid, ip)); + (strlib->bin2hex_((sd->passwd),(passhash),(16))); + sd->passwdenc = PWENC_BOTH; + } + + if (sd->passwdenc != PWENC_NONE && login->config->use_md5_passwds) { + login->auth_failed(sd, 3); + return +# 1485 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1485 "../../../server-code/src/login/login.c" + ; + } + + result = login->mmo_auth(sd, +# 1488 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1488 "../../../server-code/src/login/login.c" + ); + + if( result == -1 ) + login->auth_ok(sd); + else + login->auth_failed(sd, result); + return +# 1494 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1494 "../../../server-code/src/login/login.c" + ; +} + +void login_send_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_send_coding_key(int fd, struct login_session_data* sd) +{ + WFIFOHEAD(fd,4 + sd->md5keylen); + WFIFOW(fd,0) = 0x01dc; + WFIFOW(fd,2) = 4 + sd->md5keylen; + memcpy(WFIFOP(fd,4), sd->md5key, sd->md5keylen); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void login_parse_request_coding_key(int fd, struct login_session_data* sd) __attribute__((nonnull (2))); +void login_parse_request_coding_key(int fd, struct login_session_data* sd) +{ + memset(sd->md5key, '\0', sizeof(sd->md5key)); + sd->md5keylen = (uint16)(12 + rnd() % 4); + MD5_Salt(sd->md5keylen, sd->md5key); + + login->send_coding_key(fd, sd); +} + +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2711; + WFIFOB(fd,2) = status; + WFIFOSET(fd,3); +} + +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +{ + char server_name[20]; + char message[256]; + uint32 server_ip; + uint16 server_port; + uint16 type; + uint16 new_; + int result; + + (strlib->safestrncpy_((sd->userid),(RFIFOP(fd,2)),((23 + 1)))); + (strlib->safestrncpy_((sd->passwd),(RFIFOP(fd,26)),((23 + 1)))); + if (login->config->use_md5_passwds) + MD5_String(sd->passwd, sd->passwd); + sd->passwdenc = PWENC_NONE; + sd->version = login->config->client_version_to_connect; + server_ip = ntohl(RFIFOL(fd,54)); + server_port = ntohs(RFIFOW(fd,58)); + (strlib->safestrncpy_((server_name),(RFIFOP(fd,60)),(20))); + type = RFIFOW(fd,82); + new_ = RFIFOW(fd,84); + RFIFOSKIP(fd,86); + + (showmsg->showInfo(("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n"), server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip)); + sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port); + login_log(sockt->session[fd]->client_addr, sd->userid, 100, message); + + result = login->mmo_auth(sd, +# 1554 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1554 "../../../server-code/src/login/login.c" + ); + if (core->runflag == LOGINSERVER_ST_RUNNING && + result == -1 && + sd->sex == 'S' && + sd->account_id >= 0 && + sd->account_id < ( (int)(sizeof(server)/sizeof((server)[0])) ) && + !sockt->session_is_valid(server[sd->account_id].fd) && + sockt->allowed_ip_check(ipl)) + { + (showmsg->showStatus(("Connection of the char-server '%s' accepted.\n"), server_name)); + (strlib->safestrncpy_((server[sd->account_id].name),(server_name),(sizeof(server[sd->account_id].name)))); + server[sd->account_id].fd = fd; + server[sd->account_id].ip = server_ip; + server[sd->account_id].port = server_port; + server[sd->account_id].users = 0; + server[sd->account_id].type = type; + server[sd->account_id].new_ = new_; + + sockt->session[fd]->func_parse = login->parse_fromchar; + sockt->session[fd]->flag.server = 1; + sockt->realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + + login->char_server_connection_status(fd, sd, 0); + } + else + { + (showmsg->showNotice(("Connection of the char-server '%s' REFUSED.\n"), server_name)); + login->char_server_connection_status(fd, sd, 3); + } +} + + + + +int login_parse_login(int fd) +{ + struct login_session_data* sd = (struct login_session_data*)sockt->session[fd]->session_data; + + char ip[16]; + uint32 ipl = sockt->session[fd]->client_addr; + sockt->ip2str(ipl, ip); + + if( sockt->session[fd]->flag.eof ) + { + (showmsg->showInfo(("Closed connection from '""\033[1;37m""%s""\033[0m""'.\n"), ip)); + sockt->close(fd); + return 0; + } + + if( sd == +# 1604 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1604 "../../../server-code/src/login/login.c" + ) + { + + if (login->config->ipban && !sockt->trusted_ip_check(ipl) && ipban_check(ipl)) { + (showmsg->showStatus(("Connection refused: IP isn't authorized (deny/allow, ip: %s).\n"), ip)); + login_log(ipl, "unknown", -3, "ip banned"); + login->login_error(fd, 3); + sockt->eof(fd); + return 0; + } + + + ((sockt->session[fd]->session_data) = (struct login_session_data *) (iMalloc->calloc(((1)),(sizeof(struct login_session_data)),"../../../server-code/src/login/login.c", 1616, __func__))); + sd = (struct login_session_data*)sockt->session[fd]->session_data; + sd->fd = fd; + } + + while (RFIFOREST(fd) >= 2) { + uint16 command = RFIFOW(fd,0); + + if (( (HPM->packets[hpParse_Login])._len_ ) > 0) { + int result = HPM->parse_packets(fd,command,hpParse_Login); + if (result == 1) + continue; + if (result == 2) + return 0; + } + + switch (command) { + + case 0x0200: + if (RFIFOREST(fd) < 26) + return 0; + login->parse_ping(fd, sd); + break; + + + case 0x0204: + if (RFIFOREST(fd) < 18) + return 0; + + login->parse_client_md5(fd, sd); + break; + + + case 0x0064: + case 0x0277: + case 0x02b0: + + case 0x01dd: + case 0x01fa: + case 0x027c: + case 0x0825: + { + size_t packet_len = RFIFOREST(fd); + + if( (command == 0x0064 && packet_len < 55) + || (command == 0x0277 && packet_len < 84) + || (command == 0x02b0 && packet_len < 85) + || (command == 0x01dd && packet_len < 47) + || (command == 0x01fa && packet_len < 48) + || (command == 0x027c && packet_len < 60) + || (command == 0x0825 && (packet_len < 4 || packet_len < RFIFOW(fd, 2))) ) + return 0; + } + { + if (login->parse_client_login(fd, sd, ip)) + return 0; + } + break; + + case 0x01db: + RFIFOSKIP(fd,2); + { + login->parse_request_coding_key(fd, sd); + } + break; + + case 0x2710: + if (RFIFOREST(fd) < 86) + return 0; + { + login->parse_request_connection(fd, sd, ip, ipl); + } + return 0; + + default: + (showmsg->showNotice(("Abnormal end of connection (ip: %s): Unknown packet 0x%x\n"), ip, command)); + sockt->eof(fd); + return 0; + } + } + + return 0; +} + + +void login_config_set_defaults(void) +{ + login->config->login_ip = INADDR_ANY; + login->config->login_port = 6900; + login->config->ipban_cleanup_interval = 60; + login->config->ip_sync_interval = 0; + login->config->log_login = +# 1707 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1707 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->date_format),("%Y-%m-%d %H:%M:%S"),(sizeof(login->config->date_format)))); + login->config->new_account_flag = +# 1709 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1709 "../../../server-code/src/login/login.c" + ; + login->config->new_acc_length_limit = +# 1710 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1710 "../../../server-code/src/login/login.c" + ; + login->config->use_md5_passwds = +# 1711 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1711 "../../../server-code/src/login/login.c" + ; + login->config->group_id_to_connect = -1; + login->config->min_group_id_to_connect = -1; + login->config->check_client_version = +# 1714 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1714 "../../../server-code/src/login/login.c" + ; + login->config->client_version_to_connect = 20; + login->config->allowed_regs = 1; + login->config->time_allowed = 10; + + login->config->ipban = +# 1719 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1719 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban = +# 1720 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1720 "../../../server-code/src/login/login.c" + ; + login->config->dynamic_pass_failure_ban_interval = 5; + login->config->dynamic_pass_failure_ban_limit = 7; + login->config->dynamic_pass_failure_ban_duration = 5; + login->config->use_dnsbl = +# 1724 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1724 "../../../server-code/src/login/login.c" + ; + (strlib->safestrncpy_((login->config->dnsbl_servs),(""),(sizeof(login->config->dnsbl_servs)))); + + login->config->client_hash_check = 0; + login->config->client_hash_nodes = +# 1728 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1728 "../../../server-code/src/login/login.c" + ; +} + + + + +int login_config_read(const char *cfgName) +{ + char line[1024], w1[1024], w2[1024]; + FILE* fp; + do { if (((void)(cfgName), +# 1738 "../../../server-code/src/login/login.c" 3 4 +0 +# 1738 "../../../server-code/src/login/login.c" +)) return(1); } while(0); + fp = fopen(cfgName, "r"); + if (fp == +# 1740 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1740 "../../../server-code/src/login/login.c" + ) { + (showmsg->showError(("Configuration file (%s) not found.\n"), cfgName)); + return 1; + } + while(fgets(line, sizeof(line), fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + + if (sscanf(line, "%1023[^:]: %1023[^\r\n]", w1, w2) < 2) + continue; + + if(!strcasecmp(w1,"timestamp_format")) + (strlib->safestrncpy_((showmsg->timestamp_format),(w2),(20))); + else if(!strcasecmp(w1,"stdout_with_ansisequence")) + showmsg->stdout_with_ansisequence = (strlib->config_switch_(w2)) ? +# 1754 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1754 "../../../server-code/src/login/login.c" + : +# 1754 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1754 "../../../server-code/src/login/login.c" + ; + else if(!strcasecmp(w1,"console_silent")) { + showmsg->silent = atoi(w2); + if (showmsg->silent) + (showmsg->showInfo(("Console Silent Setting: %d\n"), atoi(w2))); + } + else if( !strcasecmp(w1, "bind_ip") ) { + login->config->login_ip = sockt->host2ip(w2); + if (login->config->login_ip) { + char ip_str[16]; + (showmsg->showStatus(("Login server binding IP address : %s -> %s\n"), w2, sockt->ip2str(login->config->login_ip, ip_str))); + } + } + else if( !strcasecmp(w1, "login_port") ) { + login->config->login_port = (uint16)atoi(w2); + } + else if(!strcasecmp(w1, "log_login")) + login->config->log_login = ( +# 1771 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1771 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + + else if(!strcasecmp(w1, "new_account")) + login->config->new_account_flag = ( +# 1774 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1774 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "new_acc_length_limit")) + login->config->new_acc_length_limit = ( +# 1776 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1776 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "start_limited_time")) + login->config->start_limited_time = atoi(w2); + else if(!strcasecmp(w1, "check_client_version")) + login->config->check_client_version = ( +# 1780 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1780 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_version_to_connect")) + login->config->client_version_to_connect = (unsigned int)strtoul(w2, +# 1782 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1782 "../../../server-code/src/login/login.c" + , 10); + else if(!strcasecmp(w1, "use_MD5_passwords")) + login->config->use_md5_passwds = ( +# 1784 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1784 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "group_id_to_connect")) + login->config->group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "min_group_id_to_connect")) + login->config->min_group_id_to_connect = atoi(w2); + else if(!strcasecmp(w1, "date_format")) + (strlib->safestrncpy_((login->config->date_format),(w2),(sizeof(login->config->date_format)))); + else if(!strcasecmp(w1, "allowed_regs")) + login->config->allowed_regs = atoi(w2); + else if(!strcasecmp(w1, "time_allowed")) + login->config->time_allowed = atoi(w2); + else if(!strcasecmp(w1, "use_dnsbl")) + login->config->use_dnsbl = ( +# 1796 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1796 "../../../server-code/src/login/login.c" + )(strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "dnsbl_servers")) + (strlib->safestrncpy_((login->config->dnsbl_servs),(w2),(sizeof(login->config->dnsbl_servs)))); + else if(!strcasecmp(w1, "ipban_cleanup_interval")) + login->config->ipban_cleanup_interval = (unsigned int)atoi(w2); + else if(!strcasecmp(w1, "ip_sync_interval")) + login->config->ip_sync_interval = (unsigned int)1000*60*atoi(w2); + else if(!strcasecmp(w1, "client_hash_check")) + login->config->client_hash_check = (strlib->config_switch_(w2)); + else if(!strcasecmp(w1, "client_hash")) { + int group = 0; + char md5[33]; + memset(md5, '\0', 33); + + if (sscanf(w2, "%d, %32s", &group, md5) == 2) { + struct client_hash_node *nnode; + ((nnode) = (struct client_hash_node *) (iMalloc->calloc(((1)),(sizeof(struct client_hash_node)),"../../../server-code/src/login/login.c", 1812, __func__))); + + if (strcasecmp(md5, "disabled") == 0) { + nnode->hash[0] = '\0'; + } else { + int i; + for (i = 0; i < 32; i += 2) { + char buf[3]; + unsigned int byte; + + memcpy(buf, &md5[i], 2); + buf[2] = 0; + + sscanf(buf, "%x", &byte); + nnode->hash[i / 2] = (uint8)(byte & 0xFF); + } + } + + nnode->group_id = group; + nnode->next = login->config->client_hash_nodes; + + login->config->client_hash_nodes = nnode; + } + } + else if(!strcasecmp(w1, "import")) + login_config_read(w2); + else + { + AccountDB* db = account_engine[0].db; + if (db) + db->set_property(db, w1, w2); + ipban_config_read(w1, w2); + loginlog_config_read(w1, w2); + HPM->parseConf(w1, w2, HPCT_LOGIN); + } + } + fclose(fp); + (showmsg->showInfo(("Finished reading %s.\n"), cfgName)); + return 0; +} + + + + +int do_final(void) { + int i; + struct client_hash_node *hn = login->config->client_hash_nodes; + + (showmsg->showStatus(("Terminating...\n"))); + + HPM->event(HPET_FINAL); + + while (hn) { + struct client_hash_node *tmp = hn; + hn = hn->next; + (iMalloc->free((tmp),"../../../server-code/src/login/login.c", 1867, __func__)); + } + + login_log(0, "login server", 100, "login server shutdown"); + + if (login->config->log_login) + loginlog_final(); + + ipban_final(); + + if( account_engine[0].db ) + { + account_engine[0].db->destroy(account_engine[0].db); + account_engine[0].db = +# 1880 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1880 "../../../server-code/src/login/login.c" + ; + } + accounts = +# 1882 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1882 "../../../server-code/src/login/login.c" + ; + login->online_db->destroy(login->online_db, +# 1883 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1883 "../../../server-code/src/login/login.c" + ); + login->auth_db->destroy(login->auth_db, +# 1884 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1884 "../../../server-code/src/login/login.c" + ); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_destroy(i); + + if( login->fd != -1 ) + { + sockt->close(login->fd); + login->fd = -1; + } + + HPM_login_do_final(); + + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1897, __func__)); + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1898, __func__)); + + HPM->event(HPET_POST_FINAL); + + (showmsg->showStatus(("Finished.\n"))); + return +# 1903 "../../../server-code/src/login/login.c" 3 4 + 0 +# 1903 "../../../server-code/src/login/login.c" + ; +} + + + + + +void do_abort(void) +{ +} + +void set_server_type(void) { + (core->server_type) = SERVER_TYPE_LOGIN; +} + + + +void do_shutdown_login(void) +{ + if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) + { + int id; + core->runflag = LOGINSERVER_ST_SHUTDOWN; + (showmsg->showStatus(("Shutting down...\n"))); + + for( id = 0; id < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++id ) + chrif_server_reset(id); + sockt->flush_fifos(); + core->runflag = CORE_ST_STOP; + } +} + + + + + + + +static +# 1941 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1941 "../../../server-code/src/login/login.c" + cmdline_arg_loginconfig (const char *name, const char *params) +{ + (iMalloc->free((login->LOGIN_CONF_NAME),"../../../server-code/src/login/login.c", 1943, __func__)); + login->LOGIN_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1944, __func__)); + return +# 1945 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1945 "../../../server-code/src/login/login.c" + ; +} + + + + + + +static +# 1953 "../../../server-code/src/login/login.c" 3 4 + _Bool +# 1953 "../../../server-code/src/login/login.c" + cmdline_arg_netconfig (const char *name, const char *params) +{ + (iMalloc->free((login->NET_CONF_NAME),"../../../server-code/src/login/login.c", 1955, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup((params),"../../../server-code/src/login/login.c", 1956, __func__)); + return +# 1957 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1957 "../../../server-code/src/login/login.c" + ; +} + + + +void cmdline_args_init_local(void) +{ + cmdline->arg_add(((unsigned int)-1), "--" "login-config", '\0', cmdline_arg_loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); + cmdline->arg_add(((unsigned int)-1), "--" "net-config", '\0', cmdline_arg_netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); +} + + + + +int do_init(int argc, char** argv) +{ + int i; + + + account_engine[0].db = account_engine[0].constructor(); + accounts = account_engine[0].db; + if( accounts == +# 1978 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 1978 "../../../server-code/src/login/login.c" + ) { + (showmsg->showFatalError(("do_init: account engine 'sql' not found.\n"))); + exit( +# 1980 "../../../server-code/src/login/login.c" 3 4 + 1 +# 1980 "../../../server-code/src/login/login.c" + ); + } + + login_defaults(); + + + login->config_set_defaults(); + + login->LOGIN_CONF_NAME = (iMalloc->astrdup(("conf/login-server.conf"),"../../../server-code/src/login/login.c", 1988, __func__)); + login->NET_CONF_NAME = (iMalloc->astrdup(("conf/network.conf"),"../../../server-code/src/login/login.c", 1989, __func__)); + + HPM_login_do_init(); + cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); + HPM->config_read(); + HPM->event(HPET_PRE_INIT); + + cmdline->exec(argc, argv, CMDLINE_OPT_NORMAL); + login_config_read(login->LOGIN_CONF_NAME); + sockt->net_config_read(login->NET_CONF_NAME); + + for( i = 0; i < ( (int)(sizeof(server)/sizeof((server)[0])) ); ++i ) + chrif_server_init(i); + + + if (login->config->log_login) + loginlog_init(); + + + ipban_init(); + + + login->online_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2011,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + timer->add_func_list(login->waiting_disconnect_timer, "login->waiting_disconnect_timer"); + + + login->auth_db = DB->alloc("../../../server-code/src/login/login.c",__func__,2015,DB_INT,(DB_OPT_RELEASE_DATA),sizeof(int)); + + + sockt->set_defaultparse(login->parse_login); + + + timer->add_func_list(login->online_data_cleanup, "login->online_data_cleanup"); + timer->add_interval(timer->gettick() + 600*1000, login->online_data_cleanup, 0, 0, 600*1000); + + + if (login->config->ip_sync_interval) { + timer->add_func_list(login->sync_ip_addresses, "login->sync_ip_addresses"); + timer->add_interval(timer->gettick() + login->config->ip_sync_interval, login->sync_ip_addresses, 0, 0, login->config->ip_sync_interval); + } + + + if(!accounts->init(accounts)) { + (showmsg->showFatalError(("do_init: Failed to initialize account engine 'sql'.\n"))); + exit( +# 2033 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2033 "../../../server-code/src/login/login.c" + ); + } + + HPM->event(HPET_INIT); + + + if ((login->fd = sockt->make_listen_bind(login->config->login_ip,login->config->login_port)) == -1) { + (showmsg->showFatalError(("Failed to bind to port '""\033[1;37m""%d""\033[0m""'\n"),login->config->login_port)); + exit( +# 2041 "../../../server-code/src/login/login.c" 3 4 + 1 +# 2041 "../../../server-code/src/login/login.c" + ); + } + + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = do_shutdown_login; + core->runflag = LOGINSERVER_ST_RUNNING; + } + + + console->display_gplnotice(); + + + (showmsg->showStatus(("The login-server is ""\033[1;32m""ready""\033[0m"" (Server is listening on the port %u).\n\n"), login->config->login_port)); + login_log(0, "login server", 100, "login server started"); + + HPM->event(HPET_READY); + + return 0; +} + +void login_defaults(void) { + login = &login_s; + + login->config = &login_config_; + login->accounts = accounts; + + login->mmo_auth = login_mmo_auth; + login->mmo_auth_new = login_mmo_auth_new; + login->waiting_disconnect_timer = login_waiting_disconnect_timer; + login->create_online_user = login_create_online_user; + login->add_online_user = login_add_online_user; + login->remove_online_user = login_remove_online_user; + login->online_db_setoffline = login_online_db_setoffline; + login->online_data_cleanup_sub = login_online_data_cleanup_sub; + login->online_data_cleanup = login_online_data_cleanup; + login->sync_ip_addresses = login_sync_ip_addresses; + login->check_encrypted = login_check_encrypted; + login->check_password = login_check_password; + login->lan_subnet_check = login_lan_subnet_check; + + login->fromchar_auth_ack = login_fromchar_auth_ack; + login->fromchar_accinfo = login_fromchar_accinfo; + login->fromchar_account = login_fromchar_account; + login->fromchar_account_update_other = login_fromchar_account_update_other; + login->fromchar_ban = login_fromchar_ban; + login->fromchar_change_sex_other = login_fromchar_change_sex_other; + login->fromchar_pong = login_fromchar_pong; + login->fromchar_parse_auth = login_fromchar_parse_auth; + login->fromchar_parse_update_users = login_fromchar_parse_update_users; + login->fromchar_parse_request_change_email = login_fromchar_parse_request_change_email; + login->fromchar_parse_account_data = login_fromchar_parse_account_data; + login->fromchar_parse_ping = login_fromchar_parse_ping; + login->fromchar_parse_change_email = login_fromchar_parse_change_email; + login->fromchar_parse_account_update = login_fromchar_parse_account_update; + login->fromchar_parse_ban = login_fromchar_parse_ban; + login->fromchar_parse_change_sex = login_fromchar_parse_change_sex; + login->fromchar_parse_account_reg2 = login_fromchar_parse_account_reg2; + login->fromchar_parse_unban = login_fromchar_parse_unban; + login->fromchar_parse_account_online = login_fromchar_parse_account_online; + login->fromchar_parse_account_offline = login_fromchar_parse_account_offline; + login->fromchar_parse_online_accounts = login_fromchar_parse_online_accounts; + login->fromchar_parse_request_account_reg2 = login_fromchar_parse_request_account_reg2; + login->fromchar_parse_update_wan_ip = login_fromchar_parse_update_wan_ip; + login->fromchar_parse_all_offline = login_fromchar_parse_all_offline; + login->fromchar_parse_change_pincode = login_fromchar_parse_change_pincode; + login->fromchar_parse_wrong_pincode = login_fromchar_parse_wrong_pincode; + login->fromchar_parse_accinfo = login_fromchar_parse_accinfo; + + login->parse_fromchar = login_parse_fromchar; + login->parse_login = login_parse_login; + login->parse_ping = login_parse_ping; + login->parse_client_md5 = login_parse_client_md5; + login->parse_client_login = login_parse_client_login; + login->parse_request_coding_key = login_parse_request_coding_key; + login->parse_request_connection = login_parse_request_connection; + login->auth_ok = login_auth_ok; + login->auth_failed = login_auth_failed; + login->char_server_connection_status = login_char_server_connection_status; + login->connection_problem = login_connection_problem; + login->kick = login_kick; + login->login_error = login_login_error; + login->send_coding_key = login_send_coding_key; + + login->config_set_defaults = login_config_set_defaults; + login->config_read = login_config_read; + login->LOGIN_CONF_NAME = +# 2126 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2126 "../../../server-code/src/login/login.c" + ; + login->NET_CONF_NAME = +# 2127 "../../../server-code/src/login/login.c" 3 4 + ((void *)0) +# 2127 "../../../server-code/src/login/login.c" + ; +} -- cgit v1.2.3-60-g2f50